Skip to content

PHP Syntax

A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document.


			echo "Blog";

If the server is shorthand support enabled, the above PHP tag can also be wriiten as,

	echo "Blog";



Here echo or print is used to print a variable. The only difference between echo and print is, echo has multiple expressions but print cannot take multiple expression. print_r() is used to print the array.


echo print
It takes multiple parameters. It does not have multiple parameters.
Echo is faster that Print.  
Echo is a statement, it doesn’t return a value. Print is a function and return values (0 or 1)


echo "php", "js", "mysql", "ajax"; // will work

but this will not,

print "php", "js", "mysql", "ajax";

PHP Variables

Variables are use for storing string, array or numbers. A variable starts with $ symbol.

   $variable = "blog";
   $my_blog = "blog";
   $myBlog = "blog";

<< Back

PHP Comments

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: