PHP Getting Started
Learn the basics of PHP with this quick and simple tutorial. Designed for the very beginners.
What is PHP?
It is an open source scripting language which can be used to develop the dynamic website easily. People are using PHP to develop small and big e-commerce applications.
History of PHP
- In 1994 the development of PHP was started by Rasmus Lerdorf
- On June 8, 1995, it was released publicly
- In 1997, Zeev Suraski and Andi Gutmans rewrote the parser.
- In 1998, PHP 3 was officially launched
- In 1999 Suraski and Gutmans producing the Zend Engine
- On May 22, 2004, PHP 4 was released and it was powered by Zend engine 1.0
Different features in PHP
- Open source, free to download and use
- Cross platform
- Compatible with any server
- Supports popular databases
- Easy to learn
Data types supported by PHP
Following data types are supported by PHP:
- Integer: It is stored as signed integers with 32 bits, with a range of -2,147,483,648 and 2,147,483,647
- Float: It is stored as IEEE floating point number with 64 bits.
- String: It is a sequence of 8-bit characters.
- Boolean: It has two literal values: 'true' and 'false'
- Array: It store an ordered map of pairs of keys and values.
- Object: It stores an instance of class.
- Resource: It is for storing file handling, or database connection.
- Null: It has only value null.
Every code in PHP starts with <?php and ends with ?>
If you want to print "I am learning php!" using PHP, then either use print or echo command, both are used to print anything on the screen, so type either :
Example 1:
<?php
print("I am learning PHP");
?>
Example 2:
<?php
echo("I am learning PHP");
?>
Output:
Above written codes will display on the screen :
I am learning PHP
print and echo are almost similar besides that they have few differences
like:
Speed: echo is slightly faster than print
Parameters: echo allows more than one parameter whereas print does not, e.g.:
<?php
print "Hello","world";
?>
will generate error, whereas:
<?php
echo "Hello","world",1,2,3;
?>
will gives the output as:
Helloworld123
Expression: print works like a function and returns true value after successfully executed. 0
Note: For further queries on basis of PHP, please visit our website:
http://roseindia.net/tutorial/php/phpbasics/tutorial/index.html
or 1