Presentation is loading. Please wait.

Presentation is loading. Please wait.

Yasar Hussain Malik - NISTE. PHP Origins Rasmus Lerdorf PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key.

Similar presentations


Presentation on theme: "Yasar Hussain Malik - NISTE. PHP Origins Rasmus Lerdorf PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key."— Presentation transcript:

1 Yasar Hussain Malik - NISTE

2 PHP Origins Rasmus Lerdorf PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key developers: Zeev Surashi and Andi Gutmans Open Source

3 Brief History of PHP PHP1 (Hypertext Preprocessor) was created by Rasmus Lerdorf in 1994. It was initially developed for HTTP usage logging and server-side form generation in Unix. PHP 2 (1995) transformed the language into a Server- side embedded scripting language. Added database support, file uploads, variables, arrays, recursive functions, conditionals, iteration, regular expressions, etc. PHP 3 (1998) added support for ODBC data sources, multiple platform support, email protocols (SNMP,IMA P), and new parser written by Zeev Suraski and Andi Gutmans. PHP 4 (2000) became an independen t component of the web server for added efficiency. The parser was renamed the Zend Engine. Many security features were added. PHP 5 (2004) adds Zend Engine II with object oriented programming, robust XML support using the libxml2 library, SOAP extension for interoperabilit y with Web Services, SQLite has been bundled with PHP

4 Brief History of PHP As of August 2004, PHP is used on 16,946,328 Domains, 1,348,793 IP Addresses http://www.php.net/usage.php This is roughly 32% of all domains on the web.

5 Brief History of PHP As of April 2007, PHP is used on 20,917,850 Domains

6 Open Source In general, open source refers to any program whose source code is made available for use or modification as users or other developers see fit. Open source software is usually developed as a public collaboration and made freely available. Open Source is a certification mark owned by the Open Source Initiative (OSI). Developers of software that is intended to be freely shared and possibly improved and redistributed by others can use the Open Source trademark if their distribution terms conform to the OSI's Open Source Definition. To summarize, the Definition model of distribution terms require that:OSI The software being distributed must be redistributed to anyone else without any restriction. The source code must be made available (so that the receiving party will be able to improve or modify it). The license can require improved versions of the software to carry a different name or version from the original software.

7 Why is PHP used? Cross Platform Runs on almost any Web server on several operating systems. One of the strongest features is the wide range of supported databases Web Servers: Apache, Microsoft IIS, Caudium, Netscape Enterprise Server Operating Systems: UNIX (HP-UX,OpenBSD,Solaris,Linux), Mac OSX, Windows NT/98/2000/XP/2003 Supported Databases: Adabas D, dBase,Empress, FilePro (read-only), Hyperwave,IBM DB2, Informix, Ingres, InterBase, FrontBase, mSQL, Direct MS-SQL, MySQL, ODBC, Oracle (OCI7 and OCI8), Ovrimos, PostgreSQL, SQLite, Solid, Sybase, Velocis,Unix dbm

8 …Why is PHP used? 3.Cost Benefits PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on technologies (libraries) for PHP that are also free. PHP SoftwareFree PlatformFree (Linux) Development ToolsFree PHP CoderPHP Coder, jEditjEdit

9 Scripting languages 1.Often evolved not designed2.Cross-platform since interpreter is easy to port 3.Designed to support a specific task – PHP -> Web support 4.Un-typed variables (but values are typed)5.Implicit variable declaration6.Implicit type conversion7.Stored only as script files

10 PHP details Procedural language Compare with Javascript which is event-driven C-like syntax - { } ; Extensive Function Library Good Web-server integration Script embedded in HTML Easy access to form data and output of HTML pages Not fully object-oriented Java is fully object oriented – all functions have to be in a class In PHP, classes are additional but quite simple to use

11 Getting Started 1. How to escape from HTML and enter PHP mode PHP parses a file by looking for one of the special tags that tells it to start interpreting the text as PHP code. The parser then executes all of the code it finds until it runs into a PHP closing tag. Starting tagEnding tagNotes <?php?>Preferred method as it allows the use of PHP with XHTML <??>Not recommended. Easier to type, but has to be enabled and may conflict with XML ?>Always available, best if used when FrontPage is the HTML editor <%>Not recommended. ASP tags support was added in 3.0.4 PHP CODE HTML

12 PHP and HTML HTML-embedded PHP scripts are essentially HTML pages with the occasional section of PHP script. PHP script is enclosed in the tag pair:

13 Examples Benefits: - Any changes to header or footer only require editing of a single file. This reduces the amount of work necessary for site maintenance and redesign. - Helps separate the content and design for easier maintenance Page 1 Content Page 5 Content Page 3 Content Page 2 Content Page 4 Content Header Footer

14 C-like language Free format - white space is ignored Statements are terminated by semi-colon ; Statements grouped by { … } Comments begin with // or a set of comments /* */ Assignment is ‘=’: $a=6 Relational operators are, == ( not a single equal) Control structures include if (cond) {..} else { }, while (cond) {.. }, for(sstartcond; increment; endcond) { } Arrays are accessed with [ ] : $x[4] is the 5th element of the array $x – indexes start at 0 Functions are called with the name followed by arguments in a fixed order enclosed in ( ) : substr(“fred”,0,2) Case sensitive - $red is a different variable to $RED

15 Function library Basic tasks String Handling Mathematics – random numbers, trig functions.. Regular Expressions Date and time handling File Input and Output And more specific functions for- Database interaction – MySQL, Oracle, Postgres, Sybase, MSSQL.. Encryption Text translation Spell-checking Image creation XML

16 String Handling String literals (constants) enclosed in double quotes “ ” or single quotes ‘ ’ Within “”, variables are replaced by their value: – called variable interpolation. “My name is $name, I think” Within single quoted strings, interpolation doesn’t occur Strings are concatenated (joined end to end) with the dot operator “key”.”board” == “keyboard” Standard functions exist: strlen(), substr() etc Values of other types can be easily converted to and from strings – numbers implicitly converted to strings in a string context. Regular expressions be used for complex pattern matching.

17 3 Tier architecture PHP script Remote services Web Server (Apache, IIS) Browser (IE, FireFox, Opera) Desktop (PC or MAC) Database Server SQL Client application HTTP HTML Web Service tables DHTML vision touch voice


Download ppt "Yasar Hussain Malik - NISTE. PHP Origins Rasmus Lerdorf PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP Hypertext Processor’ Other key."

Similar presentations


Ads by Google