Writing Your First PHP Script
Posted on 08. Sep, 2009 by irfan samad in PHP
PHP is a programming language like C or a scripting Language, , is to use it to write a real-life useful program. PHP code / script on the web server, and the plane HTML renderd page display on the client’s web browser.
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.
A PHP file also have HTML tags, just like stadard HTML tags, CSS tags, Javascript etc.
Below is a very simple script with PHP scripts, which display the test “My first PHP page” on the web browser.
Without HTML
<?php
echo "My first php page";
?>
With HTML
<HTML>
<body>
<h1>
<?php
echo "My first php page";
?>
</h1>
</body>
</HTML>
Just write script on the any text or HTML editor like (Notepad, Dreamweaver etc..) and save the file with .php extinction.





Leave a reply