So I've started reading in this bible of the dark side. After reading a few pages, I already felt the urge rising to make some mental notes.
list()
function (page 16)#
type comment as both the C++ style //
and the C style /* */
. It also has this weird side effect on closing the #
type comment on one line. You can do <?php $foo = 4; #Set foo ?> <?php echo $foo?>
(page 19-21).$|
is not a valid variable name. There goes perl compatibility ;) (page 22).define('FOO',5);
(page 23)endfor
, $this
, __sleep
, endforeach
, __wakeup
, endif
, old_function
and switch
. That last one is the worst of all... If I wanted switch
, I would have used some perl module :) (page 23)is_int()
has is_integer()
. (page 24)false
(page 27)array()
function. (page 27)$
sigil.(page 27)sort()
sorts the array by reference, not by value. (page 28)foreach($foo as $bar => $list) { echo $bar; }
which will be in Perl 6. (page 27)works without problem, but you do need the parens inecho "foo";
die("foo");
at the top level, your global $id will have been cluttered.foreach($array as $id) {
...
}
You should think of it as the array and the array ref being equivalent. You cant have both a $foo and a @foo as both are the same variable: $foo.There seems no way (at this part of the book) to distinguish the difference between a scalar and an array. They both use the $ sigil.(page 27)
In addition, treating a string as an array results in characters being picked out of the string, like Perl's substr. Well, almost:
prints "fooXar".$x = "foobar";
$x[3] = "XYZ";
echo $x;
Yes, and there's no "[There is an array() function. (page 27)
Yes, and the array_multisort() is nothing short of a nightmare. The API is very difficult, every column is a separate array, and there's no way to have it sort on a variable number of columns. Just give me the unified and very powerfulThere is more than one sort function. (page 28)
sort BLOCK LIST
from Perl, any day.
Re:That's not all...
Beatnik on 2005-01-22T14:30:51
I'll probably get those all of those items on my next few chapters. Only made it to page 29 so far:)