Форуми / Craftwork / Server-side / PHP array question

Trustmaster
#36622 24.12.2012 20:41

The stdClass Object thingie tells you that the array is not an array of arrays but is rather an array of Objects.

Another thing is that you might want to access items from both arrays by index, so you can use for loop instead of foreach.

Putting it all together, here is how you can add user_id property to each object in the array using values from another array:

for ($i = 0; $i < count($userid); $i++)
{
	$videos[$i]->user_id = $userid[$i];
}

 

May the Source be with you!