Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2004-05-28 07:21
Size: 674 bytes
 

Contents

Class file image Download
<?php

include('inifile.php');

// 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)
$ini->setLineSeparator("\r\n");

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

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

?>