3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '18 1/2"', '18"', '4"', '18 11/12"', '18 1/4"' ]; $asDecimal = preg_replace_callback( '/(\d+)(?: (\d+)\/(\d+))?"/', function ($m) { return $m[1] . (isset($m[3]) ? $m[2] / $m[3] : ''); }, $array ); var_export($asDecimal); echo "\n"; array_multisort($asDecimal, SORT_NUMERIC, $array); var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => '180.5', 1 => '18', 2 => '4', 3 => '180.91666666666667', 4 => '180.25', ) array ( 0 => '4"', 1 => '18"', 2 => '18 1/4"', 3 => '18 1/2"', 4 => '18 11/12"', )

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