Web Programming with PHP 5

Last Word: CSS I am not teaching HTML or CSS; it is a pain and it is outside the scope of this talk. CSS is not perfect; you will end up blending old stuff with as much CSS as you can. Armed with this basic HTML background, we can now introduce some PHP Syntax! That is Basic PHP! You know all the core components of syntax. To read detail about PHP, http://www.php.net/ is an excellent source; documentation and function reference. From now forward, in this talk, we look at some of the cool things PHP can do. Something new to …
Arrays in PHP There are two types of arrays: Numeric and Associative Numeric arrays: Indexed by numbers, starting at 0 Associative arrays: Key-Value pairs PHP defines a special for() loop especially for arrays… Arrays in PHP Index Value 0 12345 1 ‘Fish swim good. ‘ 2 [SimpleXML Object] … … Key Value ‘First Name’ ‘Hootie’ ‘Last Name’ ‘Blowfish’ ‘Species’ ‘Salmon’ … … Numeric Associative Construct arrays with array() The foreach() loop iterates through all defined members of the array. PHP also defines special global arrays, including the ones you see here. Remember: Arrays are just a particular type of variable Arrays and the foreach() Loop < ?php // Using Arrays $meals = array( ‘Steak’ , ‘Cat’ ); $steak_meal = $meals[0]; $defs = array( ‘Steak’ = > ‘Good’ , ‘Cat’ = > ‘Dry & Bony’ ); $review = $defs[$steak_meal]; // The foreach loop foreach ( $meal as $food ) echo “I want $food. < br / >” ; foreach ( $defs as $food = > $rev ) echo “$food is $rev < br / >” ;
Download Web Programming with PHP 5.Pdf

php tut