LEARNING STARTS WITH VIEWING THE WORLD DIFFERENTLY. Knowledge flow- A mobile learning platform provides apps, eBooks and video tutorials. Knowledge flow brings you a learning eBook of Learning PHP and MySQL . This eBook is for all information technology, computer science and web development students and professionals across the world. Follow us on Facebook Google plus Twitter For more information visit us at Knowledgeflow.in knowledgeflowapps.blogspot.in Thank you for using Knowledge flow eBooks LEARNING PHP AND MYSQL
Disclaimer
This eBook contents is for informational and study purposes only. The Knowledge flow makes no claims, promises, or guarantees about the accuracy, completeness, or adequacy of the contents of this eBook and n o legal liability or other responsibility is accepted by Knowledge flow for any errors, omissions, or statements on this eBook.
Introduction
PHP is originally a personalized home page i.e.
Now used as a server side scripting language. It is used and executed on server. It was introduce mainly for web designing purpose. PHP was actually created Rasmus Lerdorf in 1994. At present it is hypertext preprocessor. It is used for server side web development.
It can be used as a command line scripter. It can be used as a GUI for the client. It helped many software frameworks to provide RAD i.e. rapid application development. It provides dynamic contents to client. common gateway interface in C .
- In 1997 the parser was rewritten by Zeev Suraski and Andy Gutmans which lead to the existence of basic PHP .
- There had been only two stable releases with all security and bug fixes.
- PHP has a mascot which is blue elephant which was designed by Vincent Pointer.
Future of PHP
- The version 5.0 and 5.5 which were released are respectively supported till date June 2016 and August 2017.
- Version 7.0 will be released in mid October of 2015 and will be supported till 2018.
- Version 7.0 is released with the feature of uniform variable syntax, bitwise shift consistency across platform and return type declaration.
- Version 7.0 will complement its already existing parameter type declaration.
- Version 7.0 will also rectify all the already existing long time flaws of PHP .
Licensing of PHP
- PHP is a free software released free of cost software.
- Its license states that- product derived from PHP may not be called PHP , nor may PHP name should be appeared without prior written permission from group@php.net .
- You may indicate that your software had been working with PHP by saying FOO instead of PHP.
- Should not state it as PHPFOO or phpfoo .
Features of PHP
They are as follows.
- Server side- PHP wont execute within the local machines web browser, instead it will be executed in the web server.
- Cross plat formed- This feature allows the PHP script to run and executed on any operating system and web server.
- HTML embedded language- This means the commands and statement of PHP is already embedded in the HTML document.
Working of PHP PHP supports many databases and it is open source software which is free to download and use.
- Server side- PHP wont execute within the local machines web browser, instead it will be executed in the web server.
- Cross plat formed- This feature allows the PHP script to run and executed on any operating system and web server.
- HTML embedded language- This means the commands and statement of PHP is already embedded in the HTML document.
Working of PHP PHP supports many databases and it is open source software which is free to download and use.
Uses of PHP
- PHP can be used for creation of dynamic website.
- For building template that would make the site maintenance easy.
- For creation of graphics on the fly.
- For maintaining the differentiation of the type of content to be served on the basis of the users browser, IP address, date and time and various other details.
- For conducting a survey online.
- To connect databases with the web. For e.g. oracle and My SQL.
- Helps in providing a link of communication with external web.
- It performs read and process XML.
Simple scripting in PHP //HELLO IN PHP PRINT (HELLO); ?> The PHP statement is follow- PRINT (HELLO) ;?> This would display the message hello in the window browser. The PHP print function displays the value with the parenthesis as output in new window. Important things about PHP scripts-
Advantage of PHP with high security i.e. safe mode-
- The ownership should be same for the script being executed and file from which it is read or written.
- The directory should be owned by the owner of the PHP script.
- PHP cannot execute external programs which are not from the system.
Variables
Variables are used to store values like strings numbers etc. When a variable is declared, it can be used again and again in your script. Symbol used to represent PHP variables is $ . Syntax $ var _ name = value; There is no need to specify in PHP that the variable use belong to which data type. PHP converts the variable into correct data type.
A variable name can also contain alpha numerical characters but it should not contain space. Example
Arrays
Array is an ordered map actually in PHP .This type of optimization is so that it can have several different uses. Arrays value can be arrays, trees and even multidimensional arrays. Example Array ( Key => value, Key a => value2, Key b => value3, . ) Array can also be made using a key/value pair combination. These are also considered as associative arrays and hashes.
An easy way to compress hash work is to think it as a table. Example
Country (Key) | City (Value) |
Cambodia | Phnom Penh |
Lebanon | Beirut |
|
Next page