Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Beatnik (493)

  (email not shown publicly)

A 29 year old belgian who likes Mountain Dew, Girl Scout Cookies, Tim Hortons French Vanilla Flavoured Cappucinno, Belgian beer, Belgian chocolate, Belgian women, Magners Cider, chocolate chipped cookies and Perl. Likes snowboarding, snorkling, sailing and silence. Bach can really cheer him up! He still misses his dog.

Project Daddy of Spine [], a mod_perl based CMS.

In his superhero time (8.30 AM to 5.30 PM), he works on world peace.

Journal of Beatnik (493)

Saturday January 22, 2005
07:25 AM

PHP Annoyances

[ #22834 ]
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.

There is a list() function (page 16)

Function names in PHP are case INsensitive, variable names are not (page 17)

Although semicolons are required at the end of a block, they are not at the end of a ?> section. (page 18)

PHP supports both the # 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).

Apparently, $| is not a valid variable name. There goes perl compatibility ;) (page 22).

Defining constants is done in a very C like way... but not quite. define('FOO',5); (page 23)

The list of PHP core language keywords include words like 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)

There are function aliasses. is_int() has is_integer(). (page 24)

An object with no functions or values is also considered false (page 27)

There is an array() function. (page 27)

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)

sort() sorts the array by reference, not by value. (page 28)

There is more than one sort function. (page 28)


Cool is that they have the foreach($foo as $bar => $list) { echo $bar; } which will be in Perl 6. (page 27)

I'm about one third through chapter two.. I predict some more annoyances pretty soon.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Yes there are more annoyances. From the top of my head:
    • Very inconsequent in naming the built-in functions. Sometimes, there's underscores between the word parts, sometimes they're just concatenated. There's no fixed rules for the word part orders. Sometimes, related/similar functions have vastly different names: strtolower(), strtoupper(), ucfirst(), ucwords(), mb_strtolower().
    • Some keywords require parens, while others can do without: for example:

      echo "foo";

      works without problem, but you do need the p