Home Tutorial Php Phpbasics Tutorial PHP Instruction Separation

 
 

Share on Google+Share on Google+
PHP Instruction Separation
Posted on: March 6, 2010 at 12:00 AM
Advertisement
In this tutorial we will study about how to separate instruction in PHP. In general we use ; sign to separate the instructions but what are the other ways are present in PHP are discussed in this tutorial.

PHP Instruction Separation:

PHP follows the same way to terminate the instructions as C, Perl, or most of the popular languages do. PHP use ' ; ' to terminate any instruction but at the same time it is not necessary to put a semi colon at the last line of the code.

As in the example given below, we can see that none of the line has semicolon, whenever we use closing bracket it automatically indicates the end of the instruction.

(Note: The tags used in the example are not usual tags of PHP, these are called asp like tags, to enable these kind of tags change the value of the asp_tags to "on" , in php.ini file)

Example of PHP Instruction Separation:

<%echo "Hello"%>

<%echo "World"%>

Output:

HelloWorld

Example:

<?php

$var=12;

if($var==12){

?>

<strong>Equal to tweleve</strong>

<?php

}

else{

?>

<strong>Not equal to tweleve</strong>

<?php

}

?>

Output:

Equal to tweleve

 

Advertisement

Related Tags for PHP Instruction Separation:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 6, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com