Here is my problem, I am used to different languages (java,flex) where I can declare somthing and then add to it when I want. Here is my problem, I want to declare an object, run a function that will add an array to the object and then add to that object from another function. It might be easier to show you what I am trying to say:
This outputs
I want it to output
Can I create a global something to add to it whenever I want?
Thanks for the read and help,
timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
Congratulations!
Code:
global $test;
$test = new stdClass;
$test->name = 'Master';
function AddTest()
{
$arr = array();
$a = new stdClass;
$a->name = 'Tom';
$arr[] = $a;
$test->children = $arr;
}
AddTest();
print_r($test);
Code:
stdClass Object ( [name] => Master )
Code:
stdClass Object ( [name] => Master, [children] => Array ( [0] => stdClass Object ( [name] => Tom)))
Thanks for the read and help,
timgerr
-How important does a person have to be before they are considered assassinated instead of just murdered?
Congratulations!