3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array=[ (object)[ 'pId'=>6590153, 'prId'=>5371, 'expirationDate'=>'2018-07-10 23:59:59', 'creationDate'=>'2018-01-10 11:58:29', 'pkid'=>12345, 'parentObj'=>(object)[ 'id'=>654250, 'userID'=>'776134', 'pkid'=>12345 ], 'ur'=>5899, 'overAgeRate'=>'1.00' ], (object)[ 'pId'=>6590154, 'prId'=>5371, 'expirationDate'=>'2018-07-10 23:59:59', 'creationDate'=>'2018-01-10 11:58:29', 'pkid'=>12346, 'parentObj'=>(object)[ 'id'=>654250, 'userID'=>'776134', 'pkid'=>12346 ], 'ur'=>58, 'overAgeRate'=>'1.00' ], (object)[ 'pId'=>6590155, 'prId'=>5372, 'expirationDate'=>'2018-07-10 23:59:59', 'creationDate'=>'2018-01-10 11:58:29', 'pkid'=>12347, 'parentObj'=>(object)[ 'id'=>654251, 'userID'=>'776135', 'pkid'=>12347 ], 'ur'=>587, 'overAgeRate'=>'1.00' ] ]; $pkid='12346'; foreach($array as $k=>$v){ if($v->pkid== $pkid){ // found the needle unset($array[$k]); // remove object from array array_unshift($array,$v); // reinsert it at the front (reindex keys) break; // no reason to continue iterating } } var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => (object) array( 'pId' => 6590154, 'prId' => 5371, 'expirationDate' => '2018-07-10 23:59:59', 'creationDate' => '2018-01-10 11:58:29', 'pkid' => 12346, 'parentObj' => (object) array( 'id' => 654250, 'userID' => '776134', 'pkid' => 12346, ), 'ur' => 58, 'overAgeRate' => '1.00', ), 1 => (object) array( 'pId' => 6590153, 'prId' => 5371, 'expirationDate' => '2018-07-10 23:59:59', 'creationDate' => '2018-01-10 11:58:29', 'pkid' => 12345, 'parentObj' => (object) array( 'id' => 654250, 'userID' => '776134', 'pkid' => 12345, ), 'ur' => 5899, 'overAgeRate' => '1.00', ), 2 => (object) array( 'pId' => 6590155, 'prId' => 5372, 'expirationDate' => '2018-07-10 23:59:59', 'creationDate' => '2018-01-10 11:58:29', 'pkid' => 12347, 'parentObj' => (object) array( 'id' => 654251, 'userID' => '776135', 'pkid' => 12347, ), 'ur' => 587, 'overAgeRate' => '1.00', ), )

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:
181 ms | 409 KiB | 5 Q