Sunday, 22 June 2014

PHP echo

  echo is a language construct, and can be used with or without parentheses: echo or echo().
  There are some differences between echo and print:
                                echo - can output one or more strings
                                print - can only output one string, and returns always 1
Note: echo is marginally faster compared to print as echo does not return any value.


Example:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
    echo "Hello World!";
?>
</body>
</html>

Related Posts:

  • Conditional statement in PHP Conditional statement in PHP   PHP supports different types of conditional statements:- The if Statement In if Statements Output w… Read More
  • PHP OPERATORS Php operators    —Variables are simply containers for information. In order to do anything useful with them, you need Operators&n… Read More
  • PHP LOOPING PHP LOOP  —When you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we… Read More
  • PHP Numeric ceil <?php         $num=19.7   echo ceil($num); ?> In the above example, Initial… Read More
  • PHP String Functions strlen() function   —The strlen() function returns the length of a string, in characters. strtolower() Function The strtolower(… Read More