PHP02 - Functions, Arrays, Objects


eg0016.php calling built in abs() function eg0016.txt ( P84)

eg0017.php declaring a function eg0017.txt ( P85)

eg0018.php declaring a function that requires arguments eg0018.txt ( P86)

eg0019.php a function that returns a value eg0019.txt ( P87)

Note: A variable decleared within a function is unavailable outside the function.
Note: From within a function, it is not possible by default to access a variable that has been defined elsewhere.
eg0020.php variable outside functions are inaccessible from within a function eg0020.txt (P91)
eg0021.php we need a global statement. Accessing Global Variables eg0021.txt (P91)

eg0022.php using the static statement to remeber the value of a variable between function calls eg0022.txt (P93)

eg0023.php A Function with a Optional Argument eg0023.txt (P97)

eg0024.php Creating Anonymous Functions, "on the fly" eg0024.txt (P100)

eg0025.php Testing for function existence, function_exists() eg0025.txt (P101)


eg0026.php Defining Arrays with array() Construct eg0026.txt (P108)

eg0027.php Defining or Adding to Arrays with the Array Identifier eg0027.txt (P109)

eg0028.php Defining Associative Arrays with the array() Construct eg0028.txt (P110)

eg0029.php Directly Defining or Adding to an Associative Array eg0029.txt (P111)

eg0030.php Multidimensional Arrays eg0030.txt (P111)

eg0031.php Getting the Size of an Array and Loop through eg0031.txt (P113)

eg0032.php Looping through an Array eg0032.txt (P114)

eg0033.php Looping through an Associative Array eg0033.txt (P115)

eg0034.php Outputting a Multidimensional Array eg0034.txt (P116)

eg0035.php Merge Array, Adding Variables to an Array with array_push() eg0035.txt (P120)

eg0036.php Removing the First Element of an Array with array_shift() eg0036.txt (P121)

eg0037.php Slicing Arrays with array_slice() eg0037.txt (P122)

eg0038.php Sorting Numerically Indexed Arrays with sort() eg0038.txt (P123)