3v4l.org

run code in 300+ PHP versions simultaneously
<?php<?php define('SECONDE', 1); define('MINUUT', 60*SECONDE); define('UUR', 60*MINUUT); define('DAG', 24*UUR); // Bezochtte tijd function timetostr($tijd) { $output = ''; $result['dag'] = (int) ($tijd/DAG); $tijd = $tijd % DAG; $result['uur'] = (int) ($tijd/UUR); $tijd = $tijd % UUR; $result['minuut'] = (int) ($tijd/MINUUT); $tijd = $tijd % MINUUT; $result['seconde'] = $tijd; if ($result['dag']) $output[] = $result['dag'] . ($result['dag'] == 1 ? ' dag' : ' dagen'); if ($output || $result['uur']) $output[] = $result['uur'] . ($result['uur'] == 1 ? ' uur' : ' uren'); if ($output || $result['minuut']) $output[] = $result['minuut'] . ($result['minuut'] == 1 ? ' minuut' : ' minuten'); $output[] = $result['seconde'] . ($result['seconde'] == 1 ? ' seconde' : ' seconden'); $return = join($output, ', '); $return = preg_replace('/^(.*), ([^,]+)$/', '\\1 en \\2', $return); return $return; } echo timetostr(12345); ?>
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.3 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
<?php Fatal error: Uncaught Error: [] operator not supported for strings in /in/KO0U0:20 Stack trace: #0 /in/KO0U0(29): timetostr(45) #1 {main} thrown in /in/KO0U0 on line 20
Process exited with code 255.
Output for 8.0.13
Parse error: syntax error, unexpected token "?" in /in/KO0U0 on line 1
Process exited with code 255.
Output for 5.4.0 - 5.4.25, 7.3.32 - 7.3.33, 7.4.33
Parse error: syntax error, unexpected '?' in /in/KO0U0 on line 1
Process exited with code 255.
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
<?php3 uren, 25 minuten en 45 seconden

preferences:
188.49 ms | 402 KiB | 250 Q