3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( '0' => array('score' => '4','word' => 'titiek'), '1' => array('score' => '4','word' => 'titik'), '2' => array('score' => '4','word' => 'titie'), '3' => array('score' => '3','word' => 'tuatuka'), '4' => array('score' => '3','word' => 'titiks'), ); usort($data, function($a, $b) { if ($a['score'] == $b['score']) return (strlen($a['word']) >= strlen($b['word'])) ? 1 : -1; else return $b['score'] - $a['score']; }); print_r($data[0]); $max_score = max(array_column($data, 'score')); $minlength = PHP_INT_MAX; foreach ($data as $key => $value) { if ($value['score'] != $max_score) continue; if (strlen($value['word']) < $minlength) { $minlength = strlen($value['word']); $index = $key; } } print_r($data[$index]);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [score] => 4 [word] => titik ) Array ( [score] => 4 [word] => titik )

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:
124.67 ms | 405 KiB | 5 Q