Parse Ini File

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dante

    Parse Ini File

    I keep odd behaviour when trying to parse an ini file with PHP 4.3.9.
    When I read out data, I only get the first letter of a string.

    $data = parse_ini_file( 'data.ini', true);
    foreach ($data as $cur) {
    foreach ($cur as $this) {
    echo $this['Name'];
    }
    }

    What is wrong with this code?
  • Janwillem Borleffs

    #2
    Re: Parse Ini File

    Dante wrote:[color=blue]
    > I keep odd behaviour when trying to parse an ini file with PHP 4.3.9.
    > When I read out data, I only get the first letter of a string.
    >
    > $data = parse_ini_file( 'data.ini', true);
    > foreach ($data as $cur) {
    > foreach ($cur as $this) {
    > echo $this['Name'];
    > }
    > }
    >
    > What is wrong with this code?[/color]

    Compare your code with the following which does work:

    $data = parse_ini_file( 'data.ini', true);
    foreach ($data as $cur) {
    echo $cur['Name'];
    }


    JW



    Comment

    Working...