What is PHP using an example
PHP is free and can be downloaded from its official website http://www.php.net.
Why PHP ?
- PHP is Free, easy to learn and understand the syntaxes.
- PHP helps to create dynamic content websites.
- PHP can be installed in Linux, IIS, MAC OS and many more.
- PHP can run on IIS, Apache and many more.
- PHP hosting is cheaper when compared with other language hostings
- PHP supports multiple databases like MS-SQL, MYSQL, Oracle and PostgreSQL.
How to start with PHP
To get started with PHP 1st step you need to download the following
Downlaod WampServer (WAMP) - This will install Apache, MYSQL and PHP for windows
For Linux Downlaod LAMP - This will install Apache, MYSQL and PHP for Linux
Now if you want to use database MS-SQL or Oracle then do manual step up from its official website http://www.php.net.
About PHP Editor
To do the php coding either you can use phpedit is the best PHP IDE from (www.phpedit.com), Dreamweaver and many more.
Extension to save PHP files is
Before you start installing PHP make sure that you have created "www" in your storage drive because while installing PHP you need to point to "www" as your root directory.
So that you can save all your php files in "www" directory for each website development.
Note: Kindly make sure that whenever you want to create a new website create "www" directory in same drive where your old "www" directory exist. Rename the old one with some other name and then create new "www" directory.
Syntax of PHP
PHP is starts with "
"<?php " and ends with "?>" - for best practices use same style as i shown you here.
<?php ///PHP code starts here ?>
Note : Do not use "<?"..."?>", "<?PHP"..."?>" to start.keep best practices by using "<?php"..."?>"
Default PHP File in Web Server
index file is the default file in php
Simple Example using php to display color names in an ordered list.
<html> <head> <title>Displaying Color Names</title> </head> <body> <?php echo "<ol>"; echo "<li>Yellow</li>"; echo "<li>Green</li>"; echo "<li>Blue</li>"; echo "<li>Red</li>"; echo "<li>Violet</li>"; echo "<li>Brown</li>"; echo "</ol>"; ?> </body> </html>
As you see from our above code that we have successfully displayed the color names in an ordered list using PHP script embeded with HTML.
echo in PHP
echo is a language construct does not required parentheses. It simply used to output the string or simply used to print variable values.
So i hope that you have understood how to start with PHP, PHP is simple, easy to learn language.so start your PHP today and created dynamic websites. so if you have any doubts or query kindly let me know.
By Renuka Bhanarkar on 2016-05-06How to populate one dropdown from another dropdown using php mysql ajax ? pl explain in detail . Thanks .
By Shakir ali on 2014-08-20lovley
By Suffian ahmed on 2014-03-20Hi, Very nice blog and interview topics covered intelegently. Keep it up. Regards Suffian Ahmed
Add a Comment
Thank you, for commenting !!
Your comment is under moderation...
Keep reading other blogs