What is the difference between an associative array and a multidimensional array?
How many times should srand() be called?
a) Once ever
b) Once per script
c) Once for every call to shuffle(), before the call
d) Once for every call to shuffle(), after the call
To safely pass an array over the web, what is the correct sequence of function calls:
a) urlencode(), serialize(), unserialize(), urldecode()
b) urldecode(), unserialize(), serialize(), urlencode()
c) serialize(), unserialize(), urlencode(), urldecode()
d) serialize(), urlencode(), urldecode(), unserialize()
When passing a negative "step" parameter to the range() function, the initial value must always be larger than the end value: true or false?
To randomise the order of an array, which function(s) can you use:
c) Both of the above
d) Neither a) nor b)
Which of the following statements are true about arrays that have a hole (e.g. it has keys 0, 1, 2, and 4):
a) You can use foreach to loop through the array and ignore the hole
b) You can use the array_values() function to re-order the keys
c) You can use the arsort() function to re-order the keys
d) All of the above
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!
Next chapter: Further reading >>
Previous chapter: Summary
Home: Table of Contents
Copyright ©2015 Paul Hudson. Follow me: @twostraws.