PHP G PHP: Hypertext Preprocessor G Scripting language
History G 1994 - Written by Rasmus Lerdorf G 1997 - Zeev Suraski and Andi Gutmans G Rewrote parser G PHP 2
History G 1998 - PHP 3 G 2000 - PHP 4 G Still being developed G Version 4. 4. 7 - Oct. 2007 G 2004 - PHP 5
Usage G Server-side Scripting G Web development G Command-line Scripting G Shell scripting G Client-side GUI Apps G Not very common
Server-side Scripting G Main use G Code embedded in HTML to create dynamic web pages G LAMP Architecture G Advantage over others…$$$ …but first!
Syntax G Advantage: Similar to high level Programming Language G PHP code goes between tags G <? php --CODE-- ? > G Features that make it different
Syntax G Embedding HTML in PHP control structures G Will output anything between ? > and the next <? php tags
Types G Type is not explicitly set for variable by programmer G Type of variable is “juggled” throughout PHP code G Criticism due to this (errors not detected at compile time)
Types Eight different types: G Boolean G Integer G Float AKA Double G String G Array G Object G Resource G Null
Variables G Start with $ G Stores value to be reused G Text G Number G Code G Programmer or user defined
Variables G Example: G $name = “Jose Rodriguez”; G $num = 1;
Operators G G G G == != <> > < >= <= is equal to is not equal is greater than is less than is greater than or equal to is less than or equal to
Operators Example G Define variable $name G $name = “Jose”; G Check against variable $username G Name typed by user in form G $name == $username;
References G W 3 Schools G http: //www. w 3 schools. com/php/default. asp G PHP Manual G http: //www. php. net/manual/en/index. php