PHP: Echo

Is there an echo echo echo…in here? Echo, if you don’t know, is how you output stuff to the screen. Like this:

<?php echo 'Hello, how are you?'; ?>

Echo is used heavily in any php program, and you can do goofy crazy things, like:

<?php 
$firstname = 'Ryan';
$lastname = 'Coder';
echo 'Hello '.$firstname.' '.$lastname.', how are you?'; ?>

You see the ‘Hello ‘ there? The ‘ marks are telling php that to echo that text literally, and the .$firstname. part is using the . (dot, or period) to concatenateW (or fuse together the things on both sides of the dot. So the above will — of course — output:

Hello Ryan Coder, how are you?
, , ,

Leave a Reply

You must be logged in to post a comment.