With an increasing community; PHP is considered today as one of the most famous scripting languages. It is widely used today as a general purpose scripting language, particularly useful for web developments and like other scripting languages; it can also be embedded directly into the HTML code. Within a short span of time, PHP has gained remarkable popularity and its community is increasing rapidly. There are various reasons for that, for instance:
My security bunny found a more fortified position
- PHP, as you may know, is a free software and anyone can download it; use it and it supports various operating systems
- The syntax of PHP is quite similar to C which makes it more appealing for computer programmers.
- Whatever you have done with Perl in the past, you can do it with PHP.
- PHP is web specific and is more powerful than Perl.
- PHP works equally well and can be deployed on many web servers like Apache, IIS etc
- PHP scripts can be used for various standard network protocols as well.
My New Cube
PHP was originally a personal project called as Personal Home Page
Tools developed by Rasmus Lerdorf in the year 1994. That was the
original version of PHP which consisted of some basic web tools, a
parser and some macros. After a while, in the year 1997, the parser was
again rewritten and this parser became the basis of PHP3 that gained
remarkable popularity. After that, PHP continued to grow and version 4
included a new parser with added features. Today, all the PHP
implementations are produced by the PHP group.Now, as you have learnt some basics of PHP, we shall try building a simple PHP application that will demonstrate you and will help you in learning PHP. Carefully go through the following steps:
- First of all, you must be aware of the fact that you should have some knowledge of HTML because PHP code is directly embedded into HTML code.
- Remember that all PHP files have an extension of .phtml or .php.
- If you haven’t downloaded PHP engine and the Web server then download it immediately before you can use your code. For downloading PHP, visit www.php.net/downloads.php and for downloading Apache server, visit http://httpd.apache.org/download.cgi. Carefully follow the instructions given in the manual in order to install PHP and the Web Server.
- After you have successfully downloaded PHP and the Web Server, you are ready to create your first PHP web page.
- Open a notepad file and start writing PHP code.
- PHP syntax is very simple; every scripting block of PHP starts with <?php and ends with ?>. You can place this scripting block anywhere in the document.
- Enter the following code of the most famous Hello World example in order to learn the basic syntax of PHP
<html>
<body>
<?php
echo “Hello World”;
?>
</body>
</html>
Echo is used to write output to the browser screen. The most
important point here to remember is that, like C, every line of code in
PHP ends up with a semi colon. Echo can be replaced with print to get
the same functionality. If anyone of you has ever worked on C
programming language, you would have noticed the similarity between C
and PHP. Save the above file with .php extension and open it, you should
be able to see Hello World on the browser screen.<body>
<?php
echo “Hello World”;
?>
</body>
</html>
Comments
Post a Comment