Created
September 17, 2012 15:26
-
-
Save bayleedev/3737988 to your computer and use it in GitHub Desktop.
Will compact and extract keep the object reference?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$provider = new stdClass(); | |
echo '<pre>'; | |
echo 'First: ' . spl_object_hash($provider) . PHP_EOL; | |
function testProvider(stdClass $provider) { | |
$provider->name = 'Blaine'; | |
return compact($provider); | |
} | |
extract(testProvider($provider)); | |
echo 'Name: ' . $provider->name . PHP_EOL; | |
echo 'First: ' . spl_object_hash($provider); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Possibly overwriting the old object which lets object hash reuse it's id. Testing again and changing it's name.