简体   繁体   中英

Insert value into array object

I have an array which contains an number of array objects. Is there a way to insert something in the array object for example [d] = value4 in array object [0]?

   Array ( [0] => stdClass Object ( 
                    [a] => value1 
                    [b] => value2 
                    [c] => value3 )

   [1] => stdClass Object ( 
                    [a] => value1 
                    [b] => value2 
                    [c] => value3 )
    )

You mean like:

$thearray[0]->d = 'value4';

??

这应该做的伎俩:

$array[0]->d = 'value4';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM