Posts

Showing posts with the label PHP echo

PHP echo

The echo statement can output one or more strings. In general terms, the echo statement can display anything that can be displayed to the browser, such as strings, numbers, variables values, the results of expressions, etc. Since echo is a language construct not actually a function (like  if  a statement), you can use it without parentheses e.g.  echo  or  echo() . However, if you want to pass more than one parameter to echo, the parameters must not be enclosed within parentheses. Display Strings of Text <?php // Displaying string of text echo "Hello World!" ; ?> The output of the above PHP code will look something like this: Hello World! Display HTML Code <?php // Displaying HTML code echo "<h4>This is a simple heading.</h4>" ; echo "<h4 style='color: red;'>This is heading with style.</h4>" ; ?> The output of the above PHP code will look something like this: This is a simple heading. This is heading wi...