Parses standard INI files, maintaining comments within the file.

In contrast to IniFile, the IniCommented container parses the ini file manually using regular expressions and is slower. If you only read the file, using IniFile is more appropriate since it's faster.

Available Options
Option Data Type Default value Description
linebreak string \n Character(s) used to separate lines from each other.

Writing a .desktop file

require_once 'Config.php';

$conf = new Config();
$root $conf->getRoot();
//note: inicommented uses ";" as comment indicator while the desktop entry spec
// says that it has to be "#" - so no comments for .desktop files
$entry $root->createSection('Desktop Entry');
$entry->createDirective('Name''go to');
$r $conf->writeConfig(
//windows newlines are not required in desktop files;
    // they just serve as example how to use container options
array('linebreak' => "\r\n")
if (
PEAR::isError($r)) {
$r->getMessage() . "\n";

Generated file

[Desktop Entry]
Version = 1.0
Type = Link
Name = go to
Icon = gnome-fs-bookmark
GenericConf (Previous) IniFile (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.