3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = tempnam('.', 'test'); $fh = fopen($file, 'w+'); fwrite($fh, '[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" '); fclose($fh); // Parse with sections $ini_array = parse_ini_file($file, true); print_r($ini_array);
Output for 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
Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DMEud on line 3 Fatal error: Uncaught ValueError: Path cannot be empty in /in/DMEud:4 Stack trace: #0 /in/DMEud(4): fopen('', 'w+') #1 {main} thrown in /in/DMEud on line 4
Process exited with code 255.
Output for 7.4.33, 8.0.13
Notice: tempnam(): file created in the system's temporary directory in /in/DMEud 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.3.0 - 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/DMEud on line 3 Warning: fopen(): Filename cannot be empty in /in/DMEud on line 4 Warning: fwrite() expects parameter 1 to be resource, bool given in /in/DMEud on line 6 Warning: fclose() expects parameter 1 to be resource, bool given in /in/DMEud on line 21 Warning: parse_ini_file(): Filename cannot be empty! in /in/DMEud on line 24
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.27, 5.4.29 - 5.4.45, 5.5.0 - 5.5.38, 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.0.18 - 7.0.33, 7.1.4 - 7.1.33, 7.2.0 - 7.2.33
Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DMEud on line 3 Warning: fopen(): Filename cannot be empty in /in/DMEud on line 4 Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/DMEud on line 6 Warning: fclose() expects parameter 1 to be resource, boolean given in /in/DMEud on line 21 Warning: parse_ini_file(): Filename cannot be empty! in /in/DMEud on line 24
Output for 5.6.0 - 5.6.38, 7.0.0 - 7.0.17, 7.1.0 - 7.1.3
Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DMEud on line 3 Warning: fopen(): Filename cannot be empty in /in/DMEud on line 4 Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/DMEud on line 20 Warning: fclose() expects parameter 1 to be resource, boolean given in /in/DMEud on line 21 Warning: parse_ini_file(): Filename cannot be empty! in /in/DMEud on line 24
Output for 5.4.28
Warning: parse_ini_file(/tmp/testIyhXIY): failed to open stream: No such file or directory in /in/DMEud on line 24
Output for 4.3.0 - 4.3.3, 4.3.5 - 4.3.11, 4.4.0 - 4.4.9
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[]] => 5.3 ) )
Output for 4.3.4
Warning: parse_ini_file(): Cannot open '/tmp/testvUXr8d' for reading in /in/DMEud on line 24

preferences:
269.25 ms | 401 KiB | 452 Q