I don’t mind if I’m incomprehensible

PHP: lolwut?

with one comment

While I was helping out on a project, I noticed something that’s just so…PHP.

>> class O { var $u; }

>> $f = new O();
'u' => NULL,
>> $f->u = array('c'=>'k');
array (
'c' => 'k',
>> empty($f->u->c);

Gah! If you are new to the project and combing code to debug something, that’s difficult to notice when $f->u->c is only used in empty() calls within a bunch of if statements. However, PHP does throw a “trying to get property of non-object” notice if you try to access the non-existent value.


Written by Barry

February 1, 2008 at 7:19 pm

Posted in Nerdy

One Response

Subscribe to comments with RSS.

  1. <3 ur variable naming schema.

    I’ll have to implement that in my next project, along with more testo.


    February 12, 2008 at 1:14 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: