PHP is teh suck

The other day, I had to write a PHP script that reads a csv file of addresses and outputs the longitude and latitude of every address in the file.

Since I haven’t done a lot of PHP recently, I had to look in the documentation for the function that reads a file into an array because I couldn’t remember the name.

There is a reason for that: the name of this function is (take a deep breath):

file

Who can remember a function name that doesn’t relate to what it’s supposed to do?

In Cocoa, we have « arrayWithContentsOfFile« , and when reading some code, if you find


varName = [NSArray arrayWithContentsOfFile:someData];

Even with non-significant variable names as in this example, you can understand what this assignment does.

But when you read


varName = file(someData);

You have no clue, unless you code in PHP everyday.

I really can’t understand the logic behind the naming of functions in PHP.

Example:

Why do we have « utf8_encode« , « json_encode » but « urlencode« ?

PHP is really teh suck.

PS: I do prefer Perl as a scripting language, perhaps because I’ve done more Perl in my life than PHP. I must admit that


@varName = <someData>;

isn’t clearer, but I do prefer it.

PS2: while ranting about PHP, I wondered what was the longest method name in Cocoa, so with the help of a Perl script, here are my findings:

MacOSX 10.5:
managedObjectContextsToMonitorWhenSyncingPersistentStoreCoordinator

67 chars, I’m glad to have auto-completion in Xcode.

iPhone SDK 2.2.1
willAnimateSecondHalfOfRotationFromInterfaceOrientation

Only 55 chars, still auto-completion is a must!

Laisser un commentaire