Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums



PHP PHP Tutorial , PHP Basic , PHP Advanced , PHP Database , PHP XML , beginner's guide,primer,training,learning,internet,database,development,Web building,Webmasterhowto,reference,examples,samples.

PHP Thread, PHP Syntax in Web Development; PHP Syntax Basic PHP Syntax A PHP scripting block always starts with <?php and ends with ?> . A PHP ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=16895


Reply
 
 
The God Father
Developer's Avatar

Reply With Quote
 
Join Date: Jul 2008
Location: NDC
Posts: 5,416
14-01-2009, 03:57 PM
 
PHP Syntax


Basic PHP Syntax

A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document.
On servers with shorthand support enabled you can start a scripting block with <? and end with ?>.
For maximum compatibility, we recommend that you use the standard form (<?php) rather than the shorthand form.
[/php]<?php ?>[/php] A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.
Below, we have an example of a simple PHP script which sends the text "Hello World" to the browser:
PHP Code:
<html>
<body> <?php
echo "Hello World";
?> </body>
</html>
Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.
There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text "Hello World".
Note: The file must have the .php extension. If the file has a .html extension, the PHP code will not be executed.
Comments in PHP

In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.
PHP Code:
<html>
<body> <?php //This is a comment /*
This is
a comment
block
*/ ?> </body>
</html>
__________________
I Love Walking In The Rain Cuz Nobody Know I'm Crying !!
 
 
 
Reply

PHP Thread, PHP Syntax in Web Development; PHP Syntax Basic PHP Syntax A PHP scripting block always starts with <?php and ends with ?> . A PHP ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=16895


Bookmarks

Tags
php, syntax


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On