3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "product1" => (object) ["product_id" => "9416", "price"=>"110.00"], "product2" => (object) ["product_id"=>"9431", "price"=>"100.00"] ], [ "product1" => (object) ["product_id" => "1254", "price"=>"75.00"], "product2" => (object) ["product_id"=>"9431", "price"=>"62.00"] ], [ "product1" => (object) ["product_id" => "9416", "price"=>"45.00"], "product2" => (object) ["product_id"=>"9431", "price"=>"50.00"] ], [ "product1" => (object) ["product_id" => "9416", "price"=>"60.00"], "product2" => (object) ["product_id"=>"9431", "price"=>"25.00"] ] ]; usort($array, function($a, $b) { return $a['product1']->price + $a['product2']->price <=> $b['product1']->price + $b['product2']->price; }); var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'product1' => (object) array( 'product_id' => '9416', 'price' => '60.00', ), 'product2' => (object) array( 'product_id' => '9431', 'price' => '25.00', ), ), 1 => array ( 'product1' => (object) array( 'product_id' => '9416', 'price' => '45.00', ), 'product2' => (object) array( 'product_id' => '9431', 'price' => '50.00', ), ), 2 => array ( 'product1' => (object) array( 'product_id' => '1254', 'price' => '75.00', ), 'product2' => (object) array( 'product_id' => '9431', 'price' => '62.00', ), ), 3 => array ( 'product1' => (object) array( 'product_id' => '9416', 'price' => '110.00', ), 'product2' => (object) array( 'product_id' => '9431', 'price' => '100.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:
34.43 ms | 408 KiB | 5 Q