Created
May 10, 2012 05:10
-
-
Save danpoltawski/2651157 to your computer and use it in GitHub Desktop.
php references fun
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 | |
$array = array( | |
new stdClass, | |
new stdClass | |
); | |
$count = 0; | |
foreach ($array as &$object) { | |
$object->count = $count; | |
$count++; | |
} | |
$object = new stdClass; | |
$object->newthing = 'Yep this is going into the referenced object'; | |
echo '<pre>'.print_r($array, true).'<pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment