PHPConstants

Parses a set of PHP define() from a PHP source file. Comments are maintained by this container, although blank lines will be lost. There are no options for this container.

Writing a PHPConstants config file

<?php
require_once 'Config.php';

$conf = new Config();
$root $conf->getRoot();
$root->createComment('Demo config file with PHPConstants container');
$root->createDirective('openLastFile'true);

$root->createBlank();
//PHPConstants container does not support sections but puts them in the main
// namespace
$dbsect $root->createSection('database');
$dbsect->createDirective('host''db-server.example.org');
$dbsect->createDirective('name''demo-db');

$r $conf->writeConfig('php-constants-write.txt''phpconstants');
if (
PEAR::isError($r)) {
    echo 
$r->getMessage() . "\n";
}
?>

Generated file

<?php

/**
 *
 * AUTOMATICALLY GENERATED CODE - DO NOT EDIT BY HAND
 *
**/
// Demo config file with PHPArray container
define('OPENLASTFILE'true);


//
// database
//
define('HOST''db-server.example.org');
define('NAME''demo-db');

?>
PHPArray (Previous) XML (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.