@ 2014-10-01T08:58:47Z <?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", "5.1"]
');
fclose($fh);
// Parse with sections
$ini_array = parse_ini_file($file, true);
print_r($ini_array);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
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.6 Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DOnTf on line 3
Fatal error: Uncaught ValueError: Path cannot be empty in /in/DOnTf:4
Stack trace:
#0 /in/DOnTf(4): fopen('', 'w+')
#1 {main}
thrown in /in/DOnTf on line 4
Process exited with code 255 . Output for 7.1.0 - 7.1.7 , 7.4.33 , 8.0.13 Notice: tempnam(): file created in the system's temporary directory in /in/DOnTf 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] => [5.0,5.1]
)
)
Output for 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/DOnTf on line 3
Warning: fopen(): Filename cannot be empty in /in/DOnTf on line 4
Warning: fwrite() expects parameter 1 to be resource, bool given in /in/DOnTf on line 6
Warning: fclose() expects parameter 1 to be resource, bool given in /in/DOnTf on line 18
Warning: parse_ini_file(): Filename cannot be empty! in /in/DOnTf on line 21
Output for 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] => [5.0,5.1]
)
)
Output for 7.2.29 - 7.2.33 Warning: tempnam(): open_basedir restriction in effect. File(.) is not within the allowed path(s): (/tmp:/in:/etc) in /in/DOnTf on line 3
Warning: fopen(): Filename cannot be empty in /in/DOnTf on line 4
Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/DOnTf on line 6
Warning: fclose() expects parameter 1 to be resource, boolean given in /in/DOnTf on line 18
Warning: parse_ini_file(): Filename cannot be empty! in /in/DOnTf on line 21
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/DOnTf on line 3
Warning: fopen(): Filename cannot be empty in /in/DOnTf on line 4
Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/DOnTf on line 6
Warning: fclose() expects parameter 1 to be resource, boolean given in /in/DOnTf on line 18
Warning: parse_ini_file(): Filename cannot be empty! in /in/DOnTf on line 21
Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 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.0", "5.1"] => Array
(
)
)
Output for 4.4.9 Warning: Error parsing /tmp/testkblaoM on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.8 Warning: Error parsing /tmp/testpey7jO on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.7 Warning: Error parsing /tmp/testfY0gIN on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.6 Warning: Error parsing /tmp/testQm6CZP on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.5 Warning: Error parsing /tmp/testrAFF5T on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.4 Warning: Error parsing /tmp/test9zFeLW on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.3 Warning: Error parsing /tmp/testCq4IBY on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.2 Warning: Error parsing /tmp/testXATQE1 on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.1 Warning: Error parsing /tmp/testmJSoG4 on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.4.0 Warning: Error parsing /tmp/testNWWzY6 on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.11 Warning: Error parsing /tmp/test4yVSR8 on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.10 Warning: Error parsing /tmp/testR7gbxb on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.9 Warning: Error parsing /tmp/test8SLCab on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.8 Warning: Error parsing /tmp/test3ijOLd on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.7 Warning: Error parsing /tmp/testZGNX3g on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.6 Warning: Error parsing /tmp/testCmkRrj on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.5 Warning: Error parsing /tmp/testkzLxYi on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.4 Warning: Error parsing /tmp/testqaTWGk on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.3 Warning: Error parsing /tmp/test1oKAQo on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.2 Warning: Error parsing /tmp/testeSwPMq on line 11
in /in/DOnTf on line 21
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] => [
)
)
Output for 4.3.1 Warning: Error parsing /tmp/testi6SSAq on line 11
in Unknown on line 0
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] => [
)
)
Output for 4.3.0 Warning: Error parsing /tmp/test587U7N on line 11
in Unknown on line 0
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] => [
)
)
preferences:dark mode live preview
181.22 ms | 402 KiB | 311 Q