SlideShare a Scribd company logo
Developing Web Applications with PHP
Agenda Introduction PHP Language Basics Built-in Functions PHP on Linux and Windows Tricks and Tips PHP 5 Examples Questions?
Introduction What is PHP? PHP stands for "PHP Hypertext Preprocessor” An embedded scripting language for HTML like ASP or JSP A language that combines elements of Perl, C, and Java
Introduction History of PHP Created by Rasmus Lerdorf in 1995 for tracking access to his resume Originally a set of Perl scripts known as the “Personal Home Page” tools Rewritten in C with database functionality Added a forms interpreter and released as PHP/FI: includes Perl-like variables, and HTML embedded syntax
Introduction History of PHP (cont.)‏ Rewritten again in and released as version 2.0 in November of 1997 Estimated user base in 1997 is several thousand users and 50,000 web sites served Rewritten again in late 1997 by Andi Gutmans and Zeev Suraski More functionality added, database support, protocols and APIs
Introduction History of PHP (cont.)‏ User base in 1998 estimated 10,000 users and 100,000 web sites installed Version 3.0 was released in June 1998 as PHP Estimated user base in tens of thousands and hundreds of thousands of web sites served
Introduction History of PHP (cont.)‏ Rewritten again in 1997 by Andi Gutmans and Zeev Suraski More functionality added (OOP features), database support, protocols and APIs PHP 3.0 is released in June 1998 with some OO capability The core is rewritten in 1998 for improved performance of complex applications
Introduction History of PHP (cont.)‏ The core is rewritten in 1998 by Zeev and Andi and dubbed the “Zend Engine” The engine is introduced in mid 1999 and is released with version 4.0 in May of 2000 The estimated user base is hundreds of thousands of developers and several million of web sites served
Introduction History of PHP (cont.)‏ Version 5.0 will include version 2.0 of the Zend Engine New  object model is more powerful and intuitive Objects will no longer be passed by value; they now  will be passed by reference Increases performance and makes OOP more attractive
Introduction Netcraft Statistics 11,869,645 Domains, 1,316,288 IP Addresses
Introduction Performance* Zdnet Statistics PHP pumped out about 47 pages/second  Microsoft ASP pumped out about 43 pages/second  Allaire ColdFusion pumped out about 29 pages/second  Sun Java JSP pumped out about 13 pages/second   * From PHP HOWTO, July 2001
PHP Language Basics The Script Tags All PHP code is contained in one of several script tags: <? // Some code ?> <?php // Some code here ?>
PHP Language Basics The Script Tags (cont.)‏ <script language=“PHP&quot;>   // Some code here </script> ASP-style tags Introduced in 3.0; may be removed in the future  <%   // Some code here %>
PHP Language Basics The Script Tags (cont.)‏ “ Echo” Tags <table> <tr>   <td>Name:</td><td><?= $name ?></td> </tr> <tr>   <td>Address:</td><td><?= $address ?></td> </tr> </table>
PHP Language Basics Hello World!: An Example Like Perl, there is more than one way to do it <?php echo “Hello World!”; ?>  <?php   $greeting = “Hello World!”   printf(“%s”, $greeting); php?>
PHP Language Basics Hello World!: An Example (cont.)‏ <script language=“PHP”>   $hello = “Hello”;   $world = “World!”;   print $hello . $world </script>
PHP Language Basics Constants, Data Types and Variables Constants define a string or numeric value Constants do not begin with a dollar sign Examples: define(“COMPANY”, “Acme Enterprises”); define(“YELLOW”, “#FFFF00”); define(“PI”, 3.14); define(“NL”, “<br>\n”);
PHP Language Basics Constants, Data Types and Variables Using a constant print(“Company name: “ . COMPANY . NL);
PHP Language Basics Constants, Data Types and Variables Data types Integers, doubles and strings isValid = true;  // Boolean 25  // Integer 3.14  // Double ‘ Four’  // String “ Total value”  // Another string
PHP Language Basics Constants, Data Types and Variables Data types Strings and type conversion $street = 123; $street = $street . “ Main Street”; $city = ‘Naperville’; $state = ‘IL’; $address = $street; $address = $address . NL . “$city, $state”; $number = $address + 1;  // $number equals 124
PHP Language Basics Constants, Data Types and Variables Data types Arrays Perl-like syntax $arr = array(&quot;foo&quot; => &quot;bar&quot;, 12 => true);  same as $arr[“foo”] = “bar”; $arr[12] = true;
PHP Language Basics Constants, Data Types and Variables Arrays (cont.)‏ <?php   $arr = array(&quot;somearray&quot; => array(6 => 5, 13 => 9,   &quot;a&quot; => 42));   echo $arr[&quot;somearray&quot;][6];  // 5   echo $arr[&quot;somearray&quot;][13];  // 9   echo $arr[&quot;somearray&quot;][&quot;a&quot;];  // 42 ?>
PHP Language Basics Constants, Data Types and Variables Objects Currently not much more advanced than than associative arrays Using constants Before version 5.0, objects are passed by value Slow Functions can not easily change object variables
PHP Language Basics Constants, Data Types and Variables Operators Contains all of the operators like in C and Perl (even the ternary)‏ Statements if, if/elseif Switch/case for, while, and do/while loops Include and require statements for code reuse
Built-in Functions What comes In the box? Array Manipulator Functions sort, merge, push, pop, slice, splice, keys, count CCVS: Interface to Red Hat’s credit system COM functions: Interface to Windows COM objects Date and Time Functions getdate, mkdate, date, gettimeofday, localtime, strtotime, time
Built-in Functions What comes In the box? Directory Functions Platform independent Error Handling Functions Recover from warnings and errors  Filesystem Functions Access flat files Check directory, link, and file status information Copy, delete, and rename files
Built-in Functions What comes In the box? IMAP Functions Manipulate mail boxes via the IMAP protocol LDAP Functions Works with most LDAP servers  Mail Functions mail($recipient, $subject, $message)‏
Built-in Functions What comes In the box? Database Functions dba: dbm-style abstraction layer dBase Frontbase Informix Ingres II Interbase mSQL
Built-in Functions What comes In the box? Database Functions (cont.)‏ MySQL Oracle PostgreSQL SQL Server MING Macromedia Flash PDF Create/manipulate PDF files dynamically
Built-in Functions What comes In the box? POSIX Functions Manipulate process information Regular Expression Functions Uses POSIX regex Semaphore and Socket Functions Available only on Unix Session Management Functions
PHP on Linux and Windows Code Portability The obvious: don’t use Unix or Windows specific functions Create a reusable module for file system differences, for example: if( PHP_OS == &quot;Linux&quot; ) {   $ConfigPath = &quot;/var/www/conf&quot;;   $DataPath = &quot;/var/www/data&quot;; }
PHP on Linux and Windows Code Portability if( ereg(&quot;WIN&quot;, PHP_OS) ) {   $ApachePath = “C:/Program Files/Apache Group/Apache”;   $ConfigPath = ”$ApachePath/htdocs/conf&quot;;   $DataPath = &quot;$ApachePath/htdocs/data&quot;; } $ConfigFile = &quot;$ConfigPath/paperwork.conf&quot;; $CountryList = &quot;$DataPath/countries.txt&quot;; $StateAbbrList = &quot;$DataPath/usstateabbrs.txt&quot;; $StateNameList = &quot;$DataPath/usstatenames.txt&quot;;
Tricks and Tips Coding Prototype your web pages first Separate the design of the site from the coding Turn repetitive code into functions Makes for more maintainable and reusable code Turn grunt code into functions Database access, configuration file access
Tricks and Tips Debugging Feature: PHP is not a strongly typed language Variables can be created anywhere in your code Undocumented Feature: PHP is not a strongly typed language Typos in variable names will cause stuff to happen
Tricks and Tips Debugging Use scripts to dump form and session variables Write scripts to dump data to discover bad or missing data
Tricks and Tips Development Tools Color coding editors vim, Emacs, Visual SlickEdit IDEs Windows Macromedia Dreamweaver Allaire Homesite Zend’s PHPEdit Linux ???
PHP 5 Release Date ??? Features Complete objects Objects with constructors Abstract classes Private, protected and abstract functions Private, protected and constant variables Namespaces Exception handling with try/catch blocks
Resources PHP Downloads and Online Documentation www.php.net Community www.phpbuilder.com: articles on PHP, discussion forums www.phpresourceindex.com: over 1,000 PHP scripts www.phpvolcano.com: PHP 5 information Newsgroups comp.lang.php
Questions? Any Questions www.php.net Community www.phpbuilder.com: articles on PHP, discussion forums Newsgroups comp.lang.php

More Related Content

DOC
Php tutorial
S Bharadwaj
 
PPTX
PHP tutorial | ptutorial
PTutorial Web
 
PDF
Php tutorial
Niit
 
DOC
Article 01 What Is Php
drperl
 
PPT
Beginners PHP Tutorial
alexjones89
 
PDF
Php tutorial(w3schools)
Arjun Shanka
 
Php tutorial
S Bharadwaj
 
PHP tutorial | ptutorial
PTutorial Web
 
Php tutorial
Niit
 
Article 01 What Is Php
drperl
 
Beginners PHP Tutorial
alexjones89
 
Php tutorial(w3schools)
Arjun Shanka
 

What's hot (15)

PPT
Php(report)
Yhannah
 
PPTX
Php Tutorial
pratik tambekar
 
PPT
Chapter 02 php basic syntax
Dhani Ahmad
 
DOCX
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
PDF
Php introduction
krishnapriya Tadepalli
 
PPT
Introduction to php
Meetendra Singh
 
PPT
PHP complete reference with database concepts for beginners
Mohammed Mushtaq Ahmed
 
PPT
Justmeans power point
justmeanscsr
 
PPT
Justmeans power point
justmeanscsr
 
PPTX
Php introduction and configuration
Vijay Kumar Verma
 
PPTX
Php & mysqli in urdu
Abdul Wali
 
PPT
Intro to-php-19 jun10
Kathy Reid
 
PPTX
Introduction to php
Taha Malampatti
 
PPT
Web development
Seerat Bakhtawar
 
PPT
Php mysql
Shehrevar Davierwala
 
Php(report)
Yhannah
 
Php Tutorial
pratik tambekar
 
Chapter 02 php basic syntax
Dhani Ahmad
 
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
Php introduction
krishnapriya Tadepalli
 
Introduction to php
Meetendra Singh
 
PHP complete reference with database concepts for beginners
Mohammed Mushtaq Ahmed
 
Justmeans power point
justmeanscsr
 
Justmeans power point
justmeanscsr
 
Php introduction and configuration
Vijay Kumar Verma
 
Php & mysqli in urdu
Abdul Wali
 
Intro to-php-19 jun10
Kathy Reid
 
Introduction to php
Taha Malampatti
 
Web development
Seerat Bakhtawar
 
Ad

Viewers also liked (16)

PPTX
PHP Training In Ambala! BATRA COMPUTER CENTRE
jatin batra
 
PPTX
Php live project training
TOPS Technologies
 
PPT
PHP
Gouthaman V
 
PDF
Php vulnerability presentation
Sqa Enthusiast
 
PPT
Php training in ahmedabad
TOPS Technologies
 
PDF
PHP Course in pune , PHP Training in Pimpri chinchwad ,PHP training in Pune
CNC WEB WORLD
 
ODP
PHP Training in Chandigarh - Industrial Training
Conjoinix Xscademy
 
PPTX
PHP Training in Ambala ! BATRA COMPUTER CENTRE
jatin batra
 
PPTX
PHP Training In Ambala Cantt! Batra Computer Centre
groversimrans
 
PPTX
PHP
Jawhar Ali
 
PDF
PHP Training in Hyderabad
Web Trainings Academy
 
PPTX
PHP Hub in Ambala ! Batra Computer Centre
jatin batra
 
DOCX
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report
c-tac
 
PPT
Php Ppt
vsnmurthy
 
PPTX
PHP Summer Training Presentation
Nitesh Sharma
 
PHP Training In Ambala! BATRA COMPUTER CENTRE
jatin batra
 
Php live project training
TOPS Technologies
 
Php vulnerability presentation
Sqa Enthusiast
 
Php training in ahmedabad
TOPS Technologies
 
PHP Course in pune , PHP Training in Pimpri chinchwad ,PHP training in Pune
CNC WEB WORLD
 
PHP Training in Chandigarh - Industrial Training
Conjoinix Xscademy
 
PHP Training in Ambala ! BATRA COMPUTER CENTRE
jatin batra
 
PHP Training In Ambala Cantt! Batra Computer Centre
groversimrans
 
PHP Training in Hyderabad
Web Trainings Academy
 
PHP Hub in Ambala ! Batra Computer Centre
jatin batra
 
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report
c-tac
 
Php Ppt
vsnmurthy
 
PHP Summer Training Presentation
Nitesh Sharma
 
Ad

Similar to Phpwebdevelping (20)

PPT
Phpwebdev
Luv'k Verma
 
PPT
phpwebdev.ppt
rawaccess
 
PPT
Php
zalatarunk
 
PPT
Synapse india reviews on php website development
saritasingh19866
 
PPT
Introduction To Php For Wit2009
cwarren
 
PPT
Php classes in mumbai
Vibrant Technologies & Computers
 
PPT
05php
Shahid Usman
 
PPT
Introduction to php
mohamed ashraf
 
PPT
Php introduction with history of php
pooja bhandari
 
PPT
php
Ramki Kv
 
PPT
php fundamental
zalatarunk
 
PPT
05php
sahilshamrma08
 
PPT
Introduction to php php++
Tanay Kishore Mishra
 
PPT
Synapseindia reviews sharing intro on php
SynapseindiaComplaints
 
PPT
Synapseindia reviews sharing intro on php
SynapseindiaComplaints
 
PPT
Internet Technology and its Applications
amichoksi
 
PPT
Synapseindia reviews on array php
saritasingh19866
 
PPT
rtwerewr
esolinhighered
 
PPTX
php basics
NIRMAL FELIX
 
PPT
05php
anshkhurana01
 
Phpwebdev
Luv'k Verma
 
phpwebdev.ppt
rawaccess
 
Synapse india reviews on php website development
saritasingh19866
 
Introduction To Php For Wit2009
cwarren
 
Php classes in mumbai
Vibrant Technologies & Computers
 
Introduction to php
mohamed ashraf
 
Php introduction with history of php
pooja bhandari
 
php fundamental
zalatarunk
 
Introduction to php php++
Tanay Kishore Mishra
 
Synapseindia reviews sharing intro on php
SynapseindiaComplaints
 
Synapseindia reviews sharing intro on php
SynapseindiaComplaints
 
Internet Technology and its Applications
amichoksi
 
Synapseindia reviews on array php
saritasingh19866
 
rtwerewr
esolinhighered
 
php basics
NIRMAL FELIX
 

More from mohamed ashraf (13)

PDF
Seo wordpress
mohamed ashraf
 
PDF
File9350
mohamed ashraf
 
PDF
Basic css-tutorial
mohamed ashraf
 
PPT
Html tutorial
mohamed ashraf
 
PDF
Html css
mohamed ashraf
 
PPT
15 03-0460-00-0000-css-tutorial
mohamed ashraf
 
PPT
Ubi comp27nov04
mohamed ashraf
 
Seo wordpress
mohamed ashraf
 
File9350
mohamed ashraf
 
Basic css-tutorial
mohamed ashraf
 
Html tutorial
mohamed ashraf
 
Html css
mohamed ashraf
 
15 03-0460-00-0000-css-tutorial
mohamed ashraf
 
Ubi comp27nov04
mohamed ashraf
 

Recently uploaded (20)

PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Software Development Methodologies in 2025
KodekX
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 

Phpwebdevelping

  • 2. Agenda Introduction PHP Language Basics Built-in Functions PHP on Linux and Windows Tricks and Tips PHP 5 Examples Questions?
  • 3. Introduction What is PHP? PHP stands for &quot;PHP Hypertext Preprocessor” An embedded scripting language for HTML like ASP or JSP A language that combines elements of Perl, C, and Java
  • 4. Introduction History of PHP Created by Rasmus Lerdorf in 1995 for tracking access to his resume Originally a set of Perl scripts known as the “Personal Home Page” tools Rewritten in C with database functionality Added a forms interpreter and released as PHP/FI: includes Perl-like variables, and HTML embedded syntax
  • 5. Introduction History of PHP (cont.)‏ Rewritten again in and released as version 2.0 in November of 1997 Estimated user base in 1997 is several thousand users and 50,000 web sites served Rewritten again in late 1997 by Andi Gutmans and Zeev Suraski More functionality added, database support, protocols and APIs
  • 6. Introduction History of PHP (cont.)‏ User base in 1998 estimated 10,000 users and 100,000 web sites installed Version 3.0 was released in June 1998 as PHP Estimated user base in tens of thousands and hundreds of thousands of web sites served
  • 7. Introduction History of PHP (cont.)‏ Rewritten again in 1997 by Andi Gutmans and Zeev Suraski More functionality added (OOP features), database support, protocols and APIs PHP 3.0 is released in June 1998 with some OO capability The core is rewritten in 1998 for improved performance of complex applications
  • 8. Introduction History of PHP (cont.)‏ The core is rewritten in 1998 by Zeev and Andi and dubbed the “Zend Engine” The engine is introduced in mid 1999 and is released with version 4.0 in May of 2000 The estimated user base is hundreds of thousands of developers and several million of web sites served
  • 9. Introduction History of PHP (cont.)‏ Version 5.0 will include version 2.0 of the Zend Engine New object model is more powerful and intuitive Objects will no longer be passed by value; they now will be passed by reference Increases performance and makes OOP more attractive
  • 10. Introduction Netcraft Statistics 11,869,645 Domains, 1,316,288 IP Addresses
  • 11. Introduction Performance* Zdnet Statistics PHP pumped out about 47 pages/second Microsoft ASP pumped out about 43 pages/second Allaire ColdFusion pumped out about 29 pages/second Sun Java JSP pumped out about 13 pages/second * From PHP HOWTO, July 2001
  • 12. PHP Language Basics The Script Tags All PHP code is contained in one of several script tags: <? // Some code ?> <?php // Some code here ?>
  • 13. PHP Language Basics The Script Tags (cont.)‏ <script language=“PHP&quot;> // Some code here </script> ASP-style tags Introduced in 3.0; may be removed in the future <% // Some code here %>
  • 14. PHP Language Basics The Script Tags (cont.)‏ “ Echo” Tags <table> <tr> <td>Name:</td><td><?= $name ?></td> </tr> <tr> <td>Address:</td><td><?= $address ?></td> </tr> </table>
  • 15. PHP Language Basics Hello World!: An Example Like Perl, there is more than one way to do it <?php echo “Hello World!”; ?> <?php $greeting = “Hello World!” printf(“%s”, $greeting); php?>
  • 16. PHP Language Basics Hello World!: An Example (cont.)‏ <script language=“PHP”> $hello = “Hello”; $world = “World!”; print $hello . $world </script>
  • 17. PHP Language Basics Constants, Data Types and Variables Constants define a string or numeric value Constants do not begin with a dollar sign Examples: define(“COMPANY”, “Acme Enterprises”); define(“YELLOW”, “#FFFF00”); define(“PI”, 3.14); define(“NL”, “<br>\n”);
  • 18. PHP Language Basics Constants, Data Types and Variables Using a constant print(“Company name: “ . COMPANY . NL);
  • 19. PHP Language Basics Constants, Data Types and Variables Data types Integers, doubles and strings isValid = true; // Boolean 25 // Integer 3.14 // Double ‘ Four’ // String “ Total value” // Another string
  • 20. PHP Language Basics Constants, Data Types and Variables Data types Strings and type conversion $street = 123; $street = $street . “ Main Street”; $city = ‘Naperville’; $state = ‘IL’; $address = $street; $address = $address . NL . “$city, $state”; $number = $address + 1; // $number equals 124
  • 21. PHP Language Basics Constants, Data Types and Variables Data types Arrays Perl-like syntax $arr = array(&quot;foo&quot; => &quot;bar&quot;, 12 => true); same as $arr[“foo”] = “bar”; $arr[12] = true;
  • 22. PHP Language Basics Constants, Data Types and Variables Arrays (cont.)‏ <?php $arr = array(&quot;somearray&quot; => array(6 => 5, 13 => 9, &quot;a&quot; => 42)); echo $arr[&quot;somearray&quot;][6]; // 5 echo $arr[&quot;somearray&quot;][13]; // 9 echo $arr[&quot;somearray&quot;][&quot;a&quot;]; // 42 ?>
  • 23. PHP Language Basics Constants, Data Types and Variables Objects Currently not much more advanced than than associative arrays Using constants Before version 5.0, objects are passed by value Slow Functions can not easily change object variables
  • 24. PHP Language Basics Constants, Data Types and Variables Operators Contains all of the operators like in C and Perl (even the ternary)‏ Statements if, if/elseif Switch/case for, while, and do/while loops Include and require statements for code reuse
  • 25. Built-in Functions What comes In the box? Array Manipulator Functions sort, merge, push, pop, slice, splice, keys, count CCVS: Interface to Red Hat’s credit system COM functions: Interface to Windows COM objects Date and Time Functions getdate, mkdate, date, gettimeofday, localtime, strtotime, time
  • 26. Built-in Functions What comes In the box? Directory Functions Platform independent Error Handling Functions Recover from warnings and errors Filesystem Functions Access flat files Check directory, link, and file status information Copy, delete, and rename files
  • 27. Built-in Functions What comes In the box? IMAP Functions Manipulate mail boxes via the IMAP protocol LDAP Functions Works with most LDAP servers Mail Functions mail($recipient, $subject, $message)‏
  • 28. Built-in Functions What comes In the box? Database Functions dba: dbm-style abstraction layer dBase Frontbase Informix Ingres II Interbase mSQL
  • 29. Built-in Functions What comes In the box? Database Functions (cont.)‏ MySQL Oracle PostgreSQL SQL Server MING Macromedia Flash PDF Create/manipulate PDF files dynamically
  • 30. Built-in Functions What comes In the box? POSIX Functions Manipulate process information Regular Expression Functions Uses POSIX regex Semaphore and Socket Functions Available only on Unix Session Management Functions
  • 31. PHP on Linux and Windows Code Portability The obvious: don’t use Unix or Windows specific functions Create a reusable module for file system differences, for example: if( PHP_OS == &quot;Linux&quot; ) { $ConfigPath = &quot;/var/www/conf&quot;; $DataPath = &quot;/var/www/data&quot;; }
  • 32. PHP on Linux and Windows Code Portability if( ereg(&quot;WIN&quot;, PHP_OS) ) { $ApachePath = “C:/Program Files/Apache Group/Apache”; $ConfigPath = ”$ApachePath/htdocs/conf&quot;; $DataPath = &quot;$ApachePath/htdocs/data&quot;; } $ConfigFile = &quot;$ConfigPath/paperwork.conf&quot;; $CountryList = &quot;$DataPath/countries.txt&quot;; $StateAbbrList = &quot;$DataPath/usstateabbrs.txt&quot;; $StateNameList = &quot;$DataPath/usstatenames.txt&quot;;
  • 33. Tricks and Tips Coding Prototype your web pages first Separate the design of the site from the coding Turn repetitive code into functions Makes for more maintainable and reusable code Turn grunt code into functions Database access, configuration file access
  • 34. Tricks and Tips Debugging Feature: PHP is not a strongly typed language Variables can be created anywhere in your code Undocumented Feature: PHP is not a strongly typed language Typos in variable names will cause stuff to happen
  • 35. Tricks and Tips Debugging Use scripts to dump form and session variables Write scripts to dump data to discover bad or missing data
  • 36. Tricks and Tips Development Tools Color coding editors vim, Emacs, Visual SlickEdit IDEs Windows Macromedia Dreamweaver Allaire Homesite Zend’s PHPEdit Linux ???
  • 37. PHP 5 Release Date ??? Features Complete objects Objects with constructors Abstract classes Private, protected and abstract functions Private, protected and constant variables Namespaces Exception handling with try/catch blocks
  • 38. Resources PHP Downloads and Online Documentation www.php.net Community www.phpbuilder.com: articles on PHP, discussion forums www.phpresourceindex.com: over 1,000 PHP scripts www.phpvolcano.com: PHP 5 information Newsgroups comp.lang.php
  • 39. Questions? Any Questions www.php.net Community www.phpbuilder.com: articles on PHP, discussion forums Newsgroups comp.lang.php