Total members 11890 |It is currently Fri Apr 19, 2024 9:36 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





The php semantic is close to other programming languages like (C/PERL ...) .PHP script code must be between the <? ?> or <?php ?> brackets.

Code:

<?php
 
#php code here 
 
?> 
 html code here like any html page

<? 
 
#php code here 
?>
 


'#' is for comments


Hello world php

You can include your php code within the html tags

Code:
<html>
<head>
<title>Hello world php</title>
</head>
<body>
<?php
echo "Hello World!";
?>
</body>
</html>


the output of this is

Code:
Hello World!


Semicolon
In the above example you may be see that the php line is ends with semicolon ';' .
for example again
Code:
<html>
<head>
<title>Hello world php</title>
</head>
<body>
<?php
echo 
"Hello World! ";
echo "Hello World! ";
echo "Hello World! ";
echo "Hello World! ";
echo "Hello World! ";
?>
</body>
</html>


the output is :
Code:
Hello World! Hello World! Hello World! Hello World! Hello World!



White Space

whitespace is ignored between PHP statements
Code:
<html>
<head>
<title>Hello world php</title>
</head>
<body>
<?php
echo 
"Hello World!"
 



echo "Hello World!";
?>
</body>
</html>

the output is :
Code:
Hello World!Hello World!




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : PHP Syntax
 syntax of the session_start () in php     -  
 AJAX SYNTAX ERROR IE     -  
 java Collection Syntax     -  
 compiler code of syntax analyzer in C++     -  
 correct syntax for access providers in java     -  



Topic Tags

PHP Basics
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com