Wednesday, June 20, 2012

our first php script

after we setup Apache  open this root C:\AppServ\www  an make new document  and change file extension  to  .php and open with windows notepad


and open it with notepad     OK  



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

On servers with shorthand-support, you can start a PHP script with <? and end with ?>.
For maximum compatibility, we recommend that you use the standard form (<?php) rather than the shorthand form.

that is normal to mix HTML tag  and PHP scripting code lik this example


<html>
<body>

<?php
echo "this is my first script ";
?>

</body>
</html>  



The result  will be


 this is my first script

try it and i am sure you will success 

you my ask alot of thnk about this code

let start with echo 

echo is function  to output text with PHP

print is function like echo

use any one

example with print 

<?php
print "example to see  ";
?>

ok we back to first example any text must write between  "  "  


;  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.

if you have any question  just leave comment and i will help you

No comments:

Post a Comment