PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Hugo Gonçalves  >  IniFile  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: An example of use of this class
Class: IniFile
Class for reading/writing INI files
Author: By
Last change: Add an example of setLineSeparator
Date: 12 years ago
Size: 674 bytes


Class file image Download


// Create a new object to manipulate example.ini
$ini = new IniFile("example.ini");

// In this example I want to use the Windows convention
// for line separation (\n\r)

// Get current date and time
$x = getdate();

// Add/change values in .ini file
$ini->setValue("options","last_visit",$x['mday'].'/'.$x['mon'].'/'.$x['year'].' '.$x['hours'].':'.$x['minutes'].':'.$x['seconds']);
// Update/create file
echo $ini->writeFile();