3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Zillow { private static $instance = null; public static function get_instance() { if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } // end get_instance; private function __construct() { } // end constructor public static function sort($data=array()) { array_multisort( array_column($data, 'rent'), SORT_ASC, SORT_NUMERIC, array_column($data, 'street'), SORT_ASC, SORT_NATURAL, array_column($data, 'unit'), SORT_DESC, SORT_REGULAR, $data ); return $data; } // end array_orderby } // end class // Sample array() $data = array(); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '1', 'rent' => 1200); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '3', 'rent' => 1800); $data[] = array('id' => 1, 'number' => '1049', 'street' => 'Leavenworth St', 'unit' => '11', 'rent' => 800); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '10', 'rent' => 3400); $data[] = array('id' => 1, 'number' => '1059', 'street' => 'Leavenworth St', 'unit' => '10', 'rent' => 1450); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '5', 'rent' => 1000); $zillow = Zillow::get_instance(); $printed_data = $zillow->sort($data); echo '<pre>'; var_dump($printed_data); echo '</pre>';
Output for git.master, git.master_jit, rfc.property-hooks
<pre>array(6) { [0]=> array(5) { ["id"]=> int(1) ["number"]=> string(4) "1049" ["street"]=> string(14) "Leavenworth St" ["unit"]=> string(2) "11" ["rent"]=> int(800) } [1]=> array(5) { ["id"]=> int(1) ["number"]=> string(3) "130" ["street"]=> string(10) "Battery St" ["unit"]=> string(1) "5" ["rent"]=> int(1000) } [2]=> array(5) { ["id"]=> int(1) ["number"]=> string(3) "130" ["street"]=> string(10) "Battery St" ["unit"]=> string(1) "1" ["rent"]=> int(1200) } [3]=> array(5) { ["id"]=> int(1) ["number"]=> string(4) "1059" ["street"]=> string(14) "Leavenworth St" ["unit"]=> string(2) "10" ["rent"]=> int(1450) } [4]=> array(5) { ["id"]=> int(1) ["number"]=> string(3) "130" ["street"]=> string(10) "Battery St" ["unit"]=> string(1) "3" ["rent"]=> int(1800) } [5]=> array(5) { ["id"]=> int(1) ["number"]=> string(3) "130" ["street"]=> string(10) "Battery St" ["unit"]=> string(2) "10" ["rent"]=> int(3400) } } </pre>

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:
38.72 ms | 403 KiB | 8 Q