3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $items[] = array("apple", "green", 5.13); $items[] = array("banana", "green", 5.03); $items[] = array("banana", "yellow", 6.13); $items[] = array("apple", "red", 7.13); function sortByOrder($a, $b) { return $a[2] - $b[2]; } usort($items, 'sortByOrder'); foreach ($items as $item) { echo "$item[2] : $item[0] - $item[1]\n"; }
Output for 4.3.0 - 7.1.0
5.13 : apple - green 5.03 : banana - green 6.13 : banana - yellow 7.13 : apple - red