I have the object below:
$user=
object(stdClass)(2)
{
["questions"]=> object(stdClass)(1) { [0] => object(stdClass) }
["num_root_responses_for_section"]=> string(1) "0"
}
I want add an object so that I will have an array of objects into the questions property.
$user->questions[] = $new_question_object;
Doesn't work as it isn't an array.
I want something like so:
object(stdClass)(2)
{
["questions"]=> object(stdClass)(2) {
[0]=> object(stdClass),
[1]=> object(stdClass) }
["num_root_responses_for_section"]=> string(1) "0"
}
I understand that I can count it, increment the count, then add my object. Just looking for a better way.