Skip to content

Instantly share code, notes, and snippets.

@Ibmurai

Ibmurai/lol.php

Created Feb 20, 2012
Embed
What would you like to do?
php unnamed variable and silly stdClass casting
<?php
$lol = null;
$$lol->enabled = true;
var_dump($$lol);
var_dump($lol);
/* Output:
PHP Strict Standards: Creating default object from empty value in /Users/ibmurai/lol.php on line 4
Strict Standards: Creating default object from empty value in /Users/ibmurai/lol.php on line 4
object(stdClass)#1 (1) {
["enabled"]=>
bool(true)
}
NULL
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment