Sunday, September 13, 2009

Start me Up

Syntax

PHP’s syntax is derived from many languages—predominantly the C language, but
Perl has also had a lot of influence on its syntax. With the latest object-oriented additions,
more Java-like syntax is creeping in as well.
PHP’s syntax remains simple and easy to understand.

There are four types of tags to start php line code.

PHP Standerd Tags:

1. Standard Tgs
2. Short Tags
3. Asp Tags
4. Script Tags


Short tags only avalible when they avalibe from short_open_tags in php.ini
Asp tags only avalible when they avalibe from Asp_tags in php.ini


Note: Short tags, script tags and ASP tags are all considered deprecated and their use is
strongly discouraged.

Anatomy of PHP script:

1. Every PHP script is made up of statements, Each of these instruction is to be terminated just like in c,java,perl -- with semicolen,
echo "one";
echo "two";
?>

2. This requirement is not strict in before close tag statement statement does not require a semicolen
ex:
echo "one"
?>
3. The closing tag of a PHP block at the end of a file is optional (Semicolen must).
echo "one";

Do not mis interpret

echo 'Ending tag excluded';

with

php echo 'Ending tag excluded';
<
p>But html is still visiblep>

The second one would give error. Exclude ?> if you no more html to write after the code
4. Comments:
Php supports Shell type comments

// Single line comment

# single line comment

/* Multiline
comment
* /

/**
*
* This is another style
*/
4. PHP whitespace insensitive . You could not write


No comments:

Post a Comment