3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dsn = 'git+http://github.com/phpDocumentor/phpDocumentor2;branch=develop'; $dsnParts = implode(';', $dsn); $location = $dsnParts[0]; unset($dsnParts[0]); $locationParts = parse_url($location); $options = array(); foreach($dsnParts as $part) { $option = explode('=', $part); $options[$option[0]] = $option[1]; } var_dump($locationParts); var_dump($options);
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.6
Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /in/Rj3Br:4 Stack trace: #0 /in/Rj3Br(4): implode(';', 'git+http://gith...') #1 {main} thrown in /in/Rj3Br on line 4
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: implode(): Invalid arguments passed in /in/Rj3Br on line 4 Notice: Trying to access array offset on value of type null in /in/Rj3Br on line 5 Warning: Invalid argument supplied for foreach() in /in/Rj3Br on line 9 array(1) { ["path"]=> string(0) "" } array(0) { }
Output for 5.2.5 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: implode(): Invalid arguments passed in /in/Rj3Br on line 4 Warning: Invalid argument supplied for foreach() in /in/Rj3Br on line 9 array(1) { ["path"]=> string(0) "" } array(0) { }
Output for 4.3.2 - 4.3.10, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.4
Warning: implode(): Bad arguments. in /in/Rj3Br on line 4 Warning: Invalid argument supplied for foreach() in /in/Rj3Br on line 9 array(1) { ["path"]=> string(0) "" } array(0) { }
Output for 4.3.11
Warning: implode(): Bad arguments. in /in/Rj3Br on line 4 array(1) { ["path"]=> string(0) "" } array(0) { }
Output for 4.3.0 - 4.3.1
Warning: implode() [http://www.php.net/function.implode]: Bad arguments. in /in/Rj3Br on line 4 Warning: Invalid argument supplied for foreach() in /in/Rj3Br on line 9 array(1) { ["path"]=> string(0) "" } array(0) { }

preferences:
317.6 ms | 402 KiB | 451 Q