PHP is a server side scripting language. Through PHP we can develop dynamic websites. Static Websites: those websites which structure contents are not changing. User’s can’t bring changing to the contents. Dynamic Websites: those websites, whose structure and contents are changing e.g. facebook.com (user upload pictures, links, videos, comments) User is interacting with the website and change the contents or modify the contents. What is PHP?
PHP is designed for use with HTML. –PHP can be embedded with HTML. –PHP return HTML to browser. –PHP code is our input. –Web pages is out output. PHP provides more flexibility than HTML alone because through HTML you can create only static web pages, through PHP you create dynamic web pages. PHP syntax is similar to C, Java and Perl. If you have knowledge of ASP then it will helpful to learn PHP. We can say ASP is Microsoft version of PHP.
Why use PHP? You want to know the limits of HTML, and you want to do more. PHP is Open Source/Free Software. (open source means, source code is available for every one for study, use and modify) (free software means its free of cost to download and free to use) PHP is cross platform to develop, to deploy and to use. (means we put PHP on window server, on MAC server or on Linux/Unix server.) PHP is web development specific. PHP can be object oriented, especially version 5.
INSTALLATION You will need? Web Server PHP Database Text Editor Web Browser
Windows Installation All-in-one Packages WAMP: www.wampserver.com/en/index.php XAMPP: www.apachefriends.org/
Embedding PHP PHP is embedded in html., tells web server begin and ends the php commands. The server access the webpage, it knows to be ready for php because we have.php extension. Server still needs some extension where php start and stops, with <?php it turned on php, start filtering
VARIATION on PHP Short open tags (considered bad form)
NOTE We will embed php code in html code. Whenever we embed php code in html, the file extension will always be.php, otherwise if extension will.html. The server treats it the php code as text. PHP code will embed in anywhere of HTML code.
STRUCTURE OF BASIC PHP STATEMENT Instruction separator, this is end of this instruction echo is a function, which print something
CONCATENATION Dot (.) is used to concatenate two strings
13 Case Sensitivity in PHP Programming language constructs in PHP are mostly case insensitive. <?php echo " Explore Africa, "; Echo " South America, "; ECHO " and Australia ! "; ?>
The Operational Trail What happens, when you actually ask for a URL in your browser before you get HTML back to you. Browser hp Server Find PageHello.php Return HTML Process PHP Databases Apache
COMMENTS IN PHP Single line comments // single line comments are like this # or like this Double line comments /* our double line comment here and we can keep typing and typing */
Difference b/w Desktop and Web App Desktop software or app execute only at local system, its extension is.exe Online web apps run when a request reach to server, that request indicate a file on server that web server execute this file and send result back to client’s browser.