3v4l.org

run code in 300+ PHP versions simultaneously
<?php $AkaraB=3; $BkaraA=4; $AkaraBnoZikan=2; $BkaraAnoZikan=3; $AbinString='1 5 7'; $BbinString='3 8 12 13'; $ouhuku = 0; $Abin = explode(' ', $AbinString); $Bbin = explode(' ', $BbinString); $now = 0; $end = false; while(true) { foreach ($Abin as $key => $value) { if($now <= $value){ $now = $value; $Abin = array_slice($Abin,$key+=1); break; }else { $end = true; } } if($end) break; $now += $AkaraBnoZikan; if ($now > 24) break; foreach ($Bbin as $key => $value) { if($now <= $value) { $now = $value; $Bbin = array_slice($Bbin, $key+=1); break; }else { $end =true; } } if($end) break; $now += $BkaraAnoZikan; if ($now > 24) break; $ouhuku++; } echo $ouhuku . "\n";
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Undefined constant " true" in /in/BMQk7:22 Stack trace: #0 {main} thrown in /in/BMQk7 on line 22
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Undefined constant " true" in /in/BMQk7:22 Stack trace: #0 {main} thrown in /in/BMQk7 on line 22
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Use of undefined constant  true - assumed ' true' (this will throw an Error in a future version of PHP) in /in/BMQk7 on line 22 1
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Use of undefined constant  true - assumed ' true' in /in/BMQk7 on line 22 1

preferences:
166.12 ms | 402 KiB | 229 Q