3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Products { public static function sortByPriceAscending($jsonString) { $info = json_decode($jsonString, true); print_r($info); usort($info, function($a, $b) { return $a['price'] - $b['price']; }); print_r($info); } } // For testing purposes (do not submit uncommented) echo Products::sortByPriceAscending('[{"name":"coffee","price":9.99},{"name":"eggs","price":1},{"name":"rice","price":4.04}]');
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [name] => coffee [price] => 9.99 ) [1] => Array ( [name] => eggs [price] => 1 ) [2] => Array ( [name] => rice [price] => 4.04 ) ) Array ( [0] => Array ( [name] => eggs [price] => 1 ) [1] => Array ( [name] => rice [price] => 4.04 ) [2] => Array ( [name] => coffee [price] => 9.99 ) )

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:
59.7 ms | 402 KiB | 8 Q