1 / 30

PHP HyPertext : Preprocessor

PHP HyPertext : Preprocessor. By: Justin T. Pleva. What is PHP?. General purpose Server-side web development Console application. Background. First created in 1994 by Rasmus Lerdorf Designed to streamline web tasks Designed to access databases for storing data. Used for web forms

Download Presentation

PHP HyPertext : Preprocessor

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP HyPertext: Preprocessor By: Justin T. Pleva

  2. What is PHP? • General purpose • Server-side web development • Console application

  3. Background • First created in 1994 by RasmusLerdorf • Designed to streamline web tasks • Designed to access databases for storing data. • Used for web forms • First public release in 1995

  4. Background • Used primarily as website scripting • Text Interpreter/filter • Installed on over 20 million websites and domains • Can install multiple versions • Current version 5.4 • Object-Oriented

  5. History • Originally named “Personal Homepage Tools” • Rewritten in 1997 using C, released publicly • Renamed to “Hypertext Preprocessor” • Version 4 introduced command line functionality • Version 5 rewrote Object support • Version 6 has been postponed

  6. Licensing • Open source • PHP License • Term “PHP” cannot be used directly in a project.

  7. Operating Environments • Windows • Mac • Linux • Almost any others • Built from source • Web servers • Apache • IIS • Lighttpd

  8. Stacks • Comes bundled with many Linux Distributions • Bundles for • Mac: MAMP (Mac, Apache, MySQL, PHP) • Linux: LAMP (Linux, Apache, MySQL, PHP) • Windows: WAMP …

  9. How it works • Client Request sent to Web server • Web server directs to PHP filter • PHP processes data and sends to web server • Web server sends back to client

  10. Syntax • Similar to major programming languages • C • Java • Can be embedded inside other languages such as HTML

  11. Syntax : Declarations • Declared PHP code with delimiters • <?php … ?> • <? … ?> • <script language=”php”> </script> • ASP Style • <% … %> • Code is only executed between these delimiters

  12. Syntax: Variables • Loosely typed, unlike C/Java // Create an integer and set equal to 3 $myVariable = 3; Prefixed name with ‘$’ Notice no type specified, this can be a string value of “3”, character ‘3’ or integer value of 3. Depends upon notation! Need to be careful with variable types!

  13. Syntax: Commenting • Similar to other langues • // This is a single line comment • /* This is a block style comment */

  14. Syntax: Functions • Functions declarations similar to C/Java Function myFunction($value1, $value2) { return $value1 + $value2; } Can be value returning or not!

  15. Syntax: Loops • Similar to C/Java • For … While … Do While … for each $i = 0; While ( $i != 5 ) { echo “Number is: “ . $i . “<br />; $i++; } Notice the ‘.’!

  16. Syntax: File handling • Can Open and write to file system • Used to read/write from a server for web content • Built in file support for: • XML • FTP • Zip • Cookies

  17. Syntax: Get/Post • Can get data using $_Get[“ “] • Useful for retrieving data from url. • Can send data using $_Post[“ “] • Useful for submitting user forms such as request information forms.

  18. Syntax: Objects • PHP is Object-Oriented • Can create classes and objects of any type • Similar to C/Java • Can have private/public methods and data members • Arrow notation instead of dot notation

  19. Syntax: Mail • Built in Email support • Create text based email • Send via 1 function.

  20. File Extensions • Standard extension: .php • Can have others • .phtml • .php5 • If multiple versions are installed, .php5 will refer to version 5 installed

  21. Usage • Command line • Dynamic websites • Content Management • Can be used for Desktop applications • GUI controls

  22. Database Support • Built to work primarily with MySQL • Capable of working with others: • MS SQL • Oracle • Postgres • PDO Driver

  23. Security • Very little security holes have been found with core PHP application • Security risks come from each individual programmer, not the PHP filter! • Bad programming habits

  24. Web Presence • 20 Million domains/websites • Comes pre installed with many Linux distributions. • Content Management Systems

  25. Web Presence: CMS • Many Content Management Systems are built with PHP • Joomla • Wordpress • Drupal • Far more built with PHP than others such as .Net

  26. Community Support • Need help? Google it. • Since PHP is so widely used, there is great community support • Content Management Systems are sometimes community built

  27. Script availability • Community Support • Open Source • http://www.hotscripts.com

  28. Development • Code in Notepad • IDE Support • Netbeans • Zend Studio • Eclipse • Codelobster

  29. Conclusion • General Scripting lanaguage • Over 20 million domains • Command line/Web server-side • Various database support • Thousands of pre-built scripts • Open source

  30. Questions?

More Related