3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ (object) [ 'trainerid' => 1, 'firstname' => 'abc', 'location' => 'area', 'photo' => 'abc.jpg', 'role' => 'user', 'city' => 'bangalore', ], (object) [ 'trainerid' => 2, 'firstname' => 'abcd', 'location' => 'area', 'photo' => 'abcd.jpg', 'role' => 'user', 'city' => 'bangalore', ], ]; $array2 = [ (object) [ 'rating' => 3.0000, 'users' => 0, 'review' => 0 ], (object) [ 'rating' => 4.0000, 'users' => 4, 'review' => 5 ] ]; $result = []; foreach ($array1 as $i => $obj1) { $result[$i] = $obj1; foreach ($array2[$i] as $k => $v) { $result[$i]->$k = $v; } } var_export($result);
Output for git.master_jit, git.master, rfc.property-hooks
array ( 0 => (object) array( 'trainerid' => 1, 'firstname' => 'abc', 'location' => 'area', 'photo' => 'abc.jpg', 'role' => 'user', 'city' => 'bangalore', 'rating' => 3.0, 'users' => 0, 'review' => 0, ), 1 => (object) array( 'trainerid' => 2, 'firstname' => 'abcd', 'location' => 'area', 'photo' => 'abcd.jpg', 'role' => 'user', 'city' => 'bangalore', 'rating' => 4.0, 'users' => 4, 'review' => 5, ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
72.47 ms | 407 KiB | 5 Q