Rocket
Rocket

Reputation: 1093

PHP4 - Parse ini

I'm doing this on an old NAS drive which has php embeded and is running PHP4.

parse_ini_file is supported, but I can't create an array of values within the returned results.

The following works :

[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("sample.ini", true);
print_r($ini_array);

but the third section just returns :

[third_section] => Array
        (
            [phpversion[]] => 5.3
        )

Not all of the values.

Am I doing this wrong or is it due to PHP 4 ?

Any alternative methods ?

Upvotes: 1

Views: 59

Answers (1)

Gordon
Gordon

Reputation: 317119

Yes, this is due to PHP4. See http://3v4l.org/DMEud

The output starting from PHP 5 will give the third section as shown in the manual, while previous version will show the behavior you encounter.

Upvotes: 1

Related Questions