5.13 ExercisesThis is NOT the latest copy of this book; click here for the latest version.
-
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:
-
a) shuffle()
-
b) mt_shuffle()
-
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
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|