PHP Extreme Odd situations

A friend of mine just sent me this site – http://www.phpwtf.org/. It’s insane good. Shows some good situations of when PHP leave you wondering WTF (sorry no better way to describe this).

Here is a great example from it:

<?php
// I just need four NULLs to demo this.
$a = array_fill(0, 4, NULL);
$a[0]++;
++
$a[1];
$a[2]--;
--
$a[3];
var_dump($a);
?>
and this is the result
array(4) {
[0]=>
int(1)
[1]=>
int(1)
[2]=>
NULL
[3]=>
NULL
}
If you want to see the full article and some more info about this particular issue, visit: http://www.phpwtf.org/
Advertisements

About mcloide

Making things simpler, just check: http://www.mcloide.com View all posts by mcloide

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: