PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Radovan Janjic   PHP INI Read and Write Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP INI Read and Write Class
Read and write configuration values in INI files
Author: By
Last change: Update of example.php
Date: 1 month ago
Size: 1,144 bytes


Class file image Download

* PHP_INI Class example file

include 'INI.class.php';

// Parse config.ini
$ini = new INI('config.ini');

'Content of: config.ini' . PHP_EOL;

// Udate settings
$ini->data['first_section']['animal'] = 'COW';

// Save settings to file

// Update settings
$ini->data['first_section']['animal'] = 'HORSE';

// Add new setting to section third_section
$ini->data['third_section']['phpversion'][] = 5.4;

// Add new section third_section and new item something
$ini->data['fourth_section']['something'] = 'some data';

// Save settings to new file

// INI obj is now using ini 2 file
echo '<hr>Content of: config-2.ini' . PHP_EOL;

// Parse config.ini

// Remove item from second_section

// Remove third_section from second ini file and save to third file

// Save settings to new file

// INI obj is now using ini 3 file
echo '<hr>Content of: config-3.ini' . PHP_EOL;