3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sortByDefault(array $domains, $default='com') { uasort($domains, function tldsort($a, $b) use ($defualt) { $default = $GLOBALS['defaulttld']; if ($a['tld'] == $default) { return -1; } elseif ($b['tld'] == $default) { return 1; } elseif ($a['tld'] == 'net') { return -1; } elseif ($b['tld'] == 'net') { return 1; } elseif ($a['tld'] == 'org') { return -1; } elseif ($b['tld'] == 'org') { return 1; } elseif ($a['tld'] == 'us') { return -1; } elseif ($b['tld'] == 'us') { return 1; } elseif ($a['tld'] == 'biz') { return -1; } elseif ($b['tld'] == 'biz') { return 1; } elseif ($a['tld'] == 'info') { return -1; } elseif ($b['tld'] == 'info') { return 1; } else { return strcmp($a['tld'], $b['tld']); } }); return $domains; } $domains = array('google.com', 'google.net', 'google.org', 'google.us', 'google.biz', 'google.info'); // Format these into arrays so that this shitty function works. $domains = array_map(function($d) { list($name, $tld) = explode('.', $d); return array('name' => $name, 'tld' => $tld); }, $domains); var_dump(sortByDefault($domains, 'biz'));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.320.0070.03512.52
5.4.310.0060.03812.52
5.4.300.0070.04012.52
5.4.290.0060.03812.51
5.4.280.0070.03512.41
5.4.270.0080.04912.41
5.4.260.0080.04212.41
5.4.250.0030.04112.41
5.4.240.0060.03612.41
5.4.230.0020.04212.40
5.4.220.0080.03612.40
5.4.210.0080.03512.40
5.4.200.0090.03612.40
5.4.190.0070.03512.39
5.4.180.0070.03612.40
5.4.170.0080.03512.41
5.4.160.0060.04212.40
5.4.150.0060.03712.40
5.4.140.0050.03812.09
5.4.130.0050.04112.07
5.4.120.0060.03412.04
5.4.110.0050.03512.03
5.4.100.0060.03712.03
5.4.90.0070.03412.03
5.4.80.0060.03612.03
5.4.70.0040.03512.03
5.4.60.0080.04812.02
5.4.50.0070.03512.02
5.4.40.0090.04812.02
5.4.30.0080.04012.01
5.4.20.0110.03112.01
5.4.10.0070.04912.01
5.4.00.0080.03911.50
5.3.290.0070.03812.80
5.3.280.0070.03612.71
5.3.270.0060.03812.72
5.3.260.0050.03912.72
5.3.250.0040.03912.72
5.3.240.0030.03912.72
5.3.230.0070.05212.71
5.3.220.0060.03712.68
5.3.210.0050.03912.68
5.3.200.0080.03412.68
5.3.190.0060.03712.68
5.3.180.0040.03812.67
5.3.170.0040.03912.67
5.3.160.0050.05412.68
5.3.150.0050.04212.67
5.3.140.0050.04112.66
5.3.130.0070.03712.66
5.3.120.0050.03912.66
5.3.110.0050.04012.66
5.3.100.0060.03612.13
5.3.90.0040.03812.11
5.3.80.0060.03912.09
5.3.70.0080.03412.09
5.3.60.0040.03712.08
5.3.50.0100.03212.02
5.3.40.0070.03512.02
5.3.30.0030.03911.98
5.3.20.0060.03511.77
5.3.10.0040.03611.74
5.3.00.0040.03711.72
5.2.170.0040.0319.22
5.2.160.0040.0309.22
5.2.150.0050.0309.21
5.2.140.0050.0309.22
5.2.130.0070.0269.18
5.2.120.0020.0319.18
5.2.110.0040.0309.18
5.2.100.0040.0299.18
5.2.90.0060.0289.18
5.2.80.0060.0399.17
5.2.70.0060.0309.17
5.2.60.0070.0399.13
5.2.50.0060.0419.10
5.2.40.0050.0399.07
5.2.30.0070.0399.05
5.2.20.0080.0379.05
5.2.10.0060.0308.95
5.2.00.0060.0278.81
5.1.60.0050.0238.09
5.1.50.0020.0278.09
5.1.40.0030.0268.07
5.1.30.0040.0338.43
5.1.20.0010.0318.44
5.1.10.0050.0268.17
5.1.00.0080.0228.17
5.0.50.0030.0226.64
5.0.40.0040.0186.50
5.0.30.0070.0296.31
5.0.20.0010.0216.28
5.0.10.0020.0216.26
5.0.00.0050.0296.25
4.4.90.0050.0134.78
4.4.80.0030.0154.75
4.4.70.0040.0144.75
4.4.60.0040.0144.76
4.4.50.0020.0164.77
4.4.40.0020.0264.71
4.4.30.0040.0154.76
4.4.20.0050.0144.84
4.4.10.0030.0154.84
4.4.00.0050.0234.76
4.3.110.0020.0184.67
4.3.100.0020.0164.66
4.3.90.0010.0164.63
4.3.80.0040.0244.58
4.3.70.0040.0144.63
4.3.60.0040.0144.63
4.3.50.0020.0174.63
4.3.40.0020.0264.54
4.3.30.0030.0153.30
4.3.20.0040.0143.29
4.3.10.0020.0153.24
4.3.00.0030.02018.56

preferences:
137.38 ms | 1394 KiB | 7 Q