3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = tempnam('.', 'test'); file_put_contents($file, '[first_section] one = 1 five = 5 animal = BIRD [second_section] path = "/usr/local/bin" URL = "http://www.example.com/~username" [third_section] phpversion[] = "5.0" phpversion[] = "5.1" phpversion[] = "5.2" phpversion[] = "5.3" '); // Parse with sections $ini_array = parse_ini_file($file, true); print_r($ini_array);
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/HqGR1 on line 3 Fatal error: Uncaught ValueError: Path cannot be empty in /in/HqGR1:4 Stack trace: #0 /in/HqGR1(4): file_put_contents('', '[first_section]...') #1 {main} thrown in /in/HqGR1 on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28
Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/HqGR1 on line 3 Fatal error: Uncaught ValueError: Path cannot be empty in /in/HqGR1:5 Stack trace: #0 /in/HqGR1(5): file_put_contents('', '[first_section]...') #1 {main} thrown in /in/HqGR1 on line 5
Process exited with code 255.
Output for 7.1.0 - 7.1.10, 7.2.0, 7.4.33, 8.0.13
Notice: tempnam(): file created in the system's temporary directory in /in/HqGR1 on line 3 Array ( [first_section] => Array ( [one] => 1 [five] => 5 [animal] => BIRD ) [second_section] => Array ( [path] => /usr/local/bin [URL] => http://www.example.com/~username ) [third_section] => Array ( [phpversion] => Array ( [0] => 5.0 [1] => 5.1 [2] => 5.2 [3] => 5.3 ) ) )
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32
Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/HqGR1 on line 3 Warning: file_put_contents(): Filename cannot be empty in /in/HqGR1 on line 5 Warning: parse_ini_file(): Filename cannot be empty! in /in/HqGR1 on line 22
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.3.32 - 7.3.33
Array ( [first_section] => Array ( [one] => 1 [five] => 5 [animal] => BIRD ) [second_section] => Array ( [path] => /usr/local/bin [URL] => http://www.example.com/~username ) [third_section] => Array ( [phpversion] => Array ( [0] => 5.0 [1] => 5.1 [2] => 5.2 [3] => 5.3 ) ) )
Output for 7.1.20, 7.2.6
Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in) in /in/HqGR1 on line 3 Warning: file_put_contents(): Filename cannot be empty in /in/HqGR1 on line 5 Warning: parse_ini_file(): Filename cannot be empty! in /in/HqGR1 on line 22
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: file_put_contents() in /in/HqGR1 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: file_put_contents() in /in/HqGR1 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: file_put_contents() in /in/HqGR1 on line 4

preferences:
229.06 ms | 401 KiB | 313 Q