3v4l.org

run code in 300+ PHP versions simultaneously
<?php const VLANS = [ 'default' => [ 'prefix' => '', ], 'iutsb_rech' => [ 'prefix' => '129.20.', ], 'iutsb_etu' => [ 'prefix' => '148.60.', ] ]; const SHORT_VLANS = [ 'e' => 'iutsb_etu', 'r' => 'iutsb_rech', ]; function a($hostname) { $vlanShort = substr($hostname, 1, 1); if (!array_key_exists($vlanShort, self::SHORT_VLANS)) { return false; } $prefix = self::VLANS[self::SHORT_VLANS[$vlanShort]]['prefix']; $prefixLength = substr_count($prefix, '.'); $hostnameLength = strlen($hostname); $ip = []; for ($i = $prefixLength; $i < 4; $i++) { $ip[] = intval(substr($hostname, $hostnameLength + (($i - 4) * 3), 3)); } return $prefix . implode('.', $ip); } echo a('me212128');

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)
7.0.00.0030.04320.14
5.6.160.0200.07020.72
5.6.150.0000.05718.20
5.6.140.0070.08018.19
5.6.130.0130.07718.28
5.6.120.0070.04321.13
5.6.110.0130.07721.02
5.6.100.0070.04020.99
5.6.90.0170.07321.11
5.6.80.0000.04320.41
5.5.300.0070.06718.02
5.5.290.0130.07717.95
5.5.280.0030.06320.96
5.5.270.0030.06020.75
5.5.260.0100.04320.79
5.5.250.0030.08320.54
5.5.240.0230.06320.19

preferences:
138.92 ms | 1394 KiB | 7 Q