PHP Classes

File: constmgr-example.php

Recommend this page to a friend!
  Classes of Svetoslav Marinov   Constant Management class   constmgr-example.php   Download  
File: constmgr-example.php
Role: Example script
Content type: text/plain
Description: example file for constant management class
Class: Constant Management class
Define constant values that can be updated
Author: By
Last change:
Date: 18 years ago
Size: 941 bytes
 

Contents

Class file image Download
<?php

require_once( "constmgr.class.php" );

// don't define constant value let the class defines its for you
// so it can be managed later
//define( "DRAGON", "first DRAGON value-WRONG!" );

$obj =& new constmgr();

$obj->set( "DRAGON", "DRAGON value" );

print
"Defined const (wrongly accessed):" . DRAGON . "\n";
print
"New value:" . ${DRAGON} . "\n"; // always use this style to access the new value
print "Get: " . $obj->get( "DRAGON" ). "\n\n";

$obj->set( "DRAGON", "DRAGON value2" );
print
"Defined const (wrongly accessed):".DRAGON. "\n";
print
"New value:" . ${DRAGON}. "\n"; // always use this style to access the new value
print "Get: " . $obj->get( "DRAGON" ). "\n\n";


/*

Output:

Defined const (wrongly accessed):constmgr_1168a740956462d41d2176f76725f003
New value:DRAGON value
Get: DRAGON value

Defined const (wrongly accessed):constmgr_1168a740956462d41d2176f76725f003
New value:DRAGON value2
Get: DRAGON value2

*/

?>