Chapter
Useful Functions
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How can you count the elements in a PHP array?
"There are dozens of useful functions PHP defines that can be used with arrays. We’ll only highlight a few of the more useful ones. First, the count() function can be used to compute how many elements
- How can you print the contents of a PHP array in a readable format?
"For convenience and debugging, a special function, print_r() allows you to print the contents of an array in a human-readable format that resembles the key-value initialization syntax above. For exam
- Which PHP functions return an array’s keys and values?
"Two other functions, array_keys() and array_values() return new zero-indexed arrays containing the keys and the values of an array respectively."