src/WriteiniFile.php
public function write()
    {
        $file_content = null;

        foreach ($this->data_ini_file as $key_1 => $groupe) {
            $file_content .= PHP_EOL.'['.$key_1.']'.PHP_EOL;
            foreach ($groupe as $key_2 => $value_2) {
                if (is_array($value_2)) {
                    foreach ($value_2 as $key_3 => $value_3) {
                        $file_content .= $key_2.'['.$key_3.']='.self::encode($value_3).PHP_EOL;
                    }
                } else {
                    $file_content .= $key_2.'='.self::encode($value_2).PHP_EOL;
                }
            }
        }

        $file_content = preg_replace('#^'.PHP_EOL.'#', '', $file_content);
        $result = @file_put_contents($this->path_to_ini_file, $file_content);
        if (false === $result) {
            throw new \Exception(sprintf('Unable to write in the file ini: %s', $this->path_to_ini_file));
        }

        return ($result !== false) ? true : false;
    }
public function write()
    {
        $file_content = null;

        foreach ($this->data_ini_file as $key_1 => $groupe) {
            $file_content .= PHP_EOL.'['.$key_1.']'.PHP_EOL;
            foreach ($groupe as $key_2 => $value_2) {
                if (is_array($value_2)) {
                    foreach ($value_2 as $key_3 => $value_3) {
                        $file_content .= $key_2.'['.$key_3.']='.self::encode($value_3).PHP_EOL;
                    }
                } else {
                    $file_content .= $key_2.'='.self::encode($value_2).PHP_EOL;
                }
            }
        }

        $file_content = preg_replace('#^'.PHP_EOL.'#', '', $file_content);
        $result = @file_put_contents($this->path_to_ini_file, $file_content);
        if (false === $result) {
            throw new \Exception(sprintf('Unable to write in the file ini: %s', $this->path_to_ini_file));
        }

        return ($result !== false) ? true : false;
    }
public function write ( ) { $ file_content = null ; foreach ( $ this -> data_ini_file as $ key_1 => $ groupe ) { $ file_content .= PHP_EOL . '[' . $ key_1 . ']' . PHP_EOL ; foreach ( $ groupe as $ key_2 => $ value_2 ) { if ( is_array ( $ value_2 ) ) { foreach ( $ value_2 as $ key_3 => $ value_3 ) { $ file_content .= $ key_2 . '[' . $ key_3 . ']=' . self :: encode ( $ value_3 ) . PHP_EOL ; } } else { $ file_content .= $ key_2 . '=' . self :: encode ( $ value_2 ) . PHP_EOL ; } } } $ file_content = preg_replace ( '#^' . PHP_EOL . '#' , '' , $ file_content ) ; $ result = @ file_put_contents ( $ this -> path_to_ini_file , $ file_content ) ; if ( false === $ result ) { throw new \ Exception ( sprintf ( 'Unable to write in the file ini: %s' , $ this -> path_to_ini_file ) ) ; } return ( $ result !== false ) ? true : false ; }
method for write data in the ini file.

@return bool
method for write data in the ini file .