echo

Outputs one or more strings.

 

Does NOT return a value.

 

Not necessary to use ( parentheses ), but highly recommended.

 

<?php

	echo "This is an example of the echo command.<br>" ;

	echo ("This example used parenthese!<br>") ;

	$myVar = "Potato" ;

	echo $myVar ;

	echo "<br>" ;

	echo "A $myVar makes chips!<br>" ;	//interpolated

	echo ('A $myVar makes chips!') ;	//literal

?>

Displays:

This is an example of the echo command.
This example used parenthese!
Potato
A Potato makes chips!
A $myVar makes chips!

 

Leave a Reply