3v4l.org

run code in 500+ PHP versions simultaneously
<?php $spare = explode('-', '60-5000',2); print_r($spare); echo("No problems until now\n"); echo("=====================\n"); $parts = explode('-', '600', 2); echo("This is where the notice is generated:\n"); echo($parts[1]);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Array ( [0] => 60 [1] => 5000 ) No problems until now ===================== This is where the notice is generated: Warning: Undefined array key 1 in /in/LTr03 on line 10
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Array ( [0] => 60 [1] => 5000 ) No problems until now ===================== This is where the notice is generated: Notice: Undefined offset: 1 in /in/LTr03 on line 10
Output for 7.3.32 - 7.3.33
Array ( [0] => 60 [1] => 5000 ) No problems until now ===================== This is where the notice is generated:

preferences:
115.29 ms | 1484 KiB | 4 Q