Skip to content

Instantly share code, notes, and snippets.

@Ibmurai
Created February 20, 2012 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ibmurai/1869598 to your computer and use it in GitHub Desktop.
Save Ibmurai/1869598 to your computer and use it in GitHub Desktop.
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