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>