This the second manual I've purchased from MC Press that frustrates my purpose; i.e. I have a need to expand my technical knowledge so I can either be more valuable to my current employer or my next one.
As an example, on page 124, this excerpt (with regard to create_function()):
"Technically, the created PHP function has a name, but because the name starts with a null character, it's unlikely you'll ever declare a function with the same name. You can pass these lambda-style functions as variables and also use them as callback functions."
"Examine the following code carefully, it can be easy to get lost in it."
function calFunction($callback) { echo $callback(2, 3); }
$func = create_function('$a, $b', 'return $a * $b;');
callFunction($func)
"Here is the resulting output:"
6
Where do I begin?
The authors didn't feel the need to explain ANYTHING about this convoluted piece of code. Isn't that their function, to explain this stuff to the novice? The parameters passed to create_function() are 2 single-quoted strings. Are 2 strings the maximum? Does the 2nd (or last) one always start with 'return'? Why the use of the variable name $callback in the function callFunction? Is that significant or required or just descriptive? (And where was the null character they mentioned?) OK - $callback contains $func which contains a function, but still... They provide no context. When and where and why would I use this type of construct? The authors just throw this stuff on the page and warn me about getting lost in it? Are they just being lazy?
Mike Faust's "SQL Built-In Functions and Stored Procedures" was EXACTLY the same kind of waste of my time and money. If I only want the syntax, I can look it up on the web. I buy these books because I want to UNDERSTAND. I want an author who realizes he's 'speaking' to an audience (me!) that DOESN'T already know this stuff and one who has the teaching talent to explain it well.
I may just be exposing my slow-wittedness here but I'm very disappointed (again).
As an example, on page 124, this excerpt (with regard to create_function()):
"Technically, the created PHP function has a name, but because the name starts with a null character, it's unlikely you'll ever declare a function with the same name. You can pass these lambda-style functions as variables and also use them as callback functions."
"Examine the following code carefully, it can be easy to get lost in it."
function calFunction($callback) { echo $callback(2, 3); }
$func = create_function('$a, $b', 'return $a * $b;');
callFunction($func)
"Here is the resulting output:"
6
Where do I begin?
The authors didn't feel the need to explain ANYTHING about this convoluted piece of code. Isn't that their function, to explain this stuff to the novice? The parameters passed to create_function() are 2 single-quoted strings. Are 2 strings the maximum? Does the 2nd (or last) one always start with 'return'? Why the use of the variable name $callback in the function callFunction? Is that significant or required or just descriptive? (And where was the null character they mentioned?) OK - $callback contains $func which contains a function, but still... They provide no context. When and where and why would I use this type of construct? The authors just throw this stuff on the page and warn me about getting lost in it? Are they just being lazy?
Mike Faust's "SQL Built-In Functions and Stored Procedures" was EXACTLY the same kind of waste of my time and money. If I only want the syntax, I can look it up on the web. I buy these books because I want to UNDERSTAND. I want an author who realizes he's 'speaking' to an audience (me!) that DOESN'T already know this stuff and one who has the teaching talent to explain it well.
I may just be exposing my slow-wittedness here but I'm very disappointed (again).
Comment