PHP Programming For Beginners!!
PHP Programming
The PHP Programming is the one of the easy languages to learn.
What Is PHP ?
PHP is a PHP HYPERTEXT PREPROCESSOR.
It is a server - side scripting language.
PHP is faster than scripting languages like ASP and JSP.
It is used for develop dynamic website easily.
For web development you have to knowledge of HTML and CSS.
PHP code written with HTML code for making dynamic website.
How To Run PHP Program With Xampp ?
For PHP program we need a server for run the program.
We can use the servers like :
- XAMPP - can use in every platform
- WAMP - can use in windows
- LAMP - can use in linux
- MAMP - can use in mac
Steps For Run The Code
- Download Xampp in C drive
- path is c:\xampp\htdocs
- create a folder in htdocs For example : khush
- Create a PHP Program with extension ' .php '
- Save this program in c:\xampp\htdocs\khush\xyz.php
- start apache and mysql in xampp control.
- Open browser and write localhost/khush (it will show the list of document placed in the folder name khush)
- Then click on the xyz.php for run the program.
PHP Program
We write a php program with HTML language. so, we must write code between <?php and ?> php tags.
Syntax :
<?php
// code of programming
?>
Program :
So, as we can see we save program in folder khush which is placed in htdocs.
Print keyword is use for print the message.
We can also use "echo" for print the message.
Print keyword is use for print the message.
We can also use "echo" for print the message.
Output :
As we can see in output we have to write url as a localhost/khush and then it display list of files and we have to choose a file which we want to run.
We can also use html tags with php code.
For Example : If we want to get output as a h2 heading.
then, we can write as a
<?php
print "<h2>Welcome Khush"</h2>
?>
In the output font will displayed of h2 size.
Advantages Of PHP :
Ease of use :
PHP is arguably one of the easiest languages to learn and use.
Cross Platform :
PHP code will run on nearly all flavors and versions of Linux, Windows and Mac.
Open Source :
PHP itself is written in C and has always been open source and free to use.
Libraries and frameworks :
It has a huge amount of user contributed open source code in frameworks and libraries.
Community support :
There are answers and support for all aspects of PHP in Stack Overflow and other help sites.
In Addition :
PHP is general-purpose server side scripting language designed for web development.
It is among one of the first developed server-side scripting language to be embedded into an HTML source document, rather than calling an external file to process data.
Ultimately, the code is interpreted by a web server with a PHP processor module which enervates the resulting web page.
It is also has evolved to include a command line interface capability and can be used in standalone graphical applications.
PHP can be deployed on most web servers and also as a standalone shell on almost every operating system and platform free of charge.
" PHP is installed on more than 20 million web sites and 1 million web servers"
Number Of Framework Available in PHP.
- Laravel
- Code Igniter
- Zend
- Cake PHP
- Fuel PHP
- FatFree
- Aura
So, in this article we discuss about basic introduction of PHP and how to we can start PHP programming with xampp and a basic PHP program.