Download .zip |
Info | View files (4) | Download .zip | Reputation | Support forum (2) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2005-10-26 (14 years ago) | 63% | Total: 1,352 | All time: 2,848 This week: 794 |
Version | License | Categories | ||||
constmgr 1.0 | GNU General Publi... | Data types |
Description | Author | |
This is a simple class that can be used to define constant values that can be updated. |
|
constmgr 1. description 2. example 3. author 4. credits 5. conclusion 1. description ================================= constmgr is used to define constants and update their values on the fly. 1) make an instance of constmgr class 2) you MUST set/define constants using the constmgr class 3) accessing the value: ${SOME_CONSTANT} or $obj->get( "DRAGON" ); Note: possible common mistakes 1) accessing directly: SOME_CONSTANT after its definition with constmgr class e.g.: $obj =& new constmgr(); // this method call won't update the value $obj->set( "DRAGON", "DRAGON value" ); // WRONG! way print "defined const:" . DRAGON . "\n"; // RIGHT! ways // 1) print "New value:" . ${DRAGON} . "\n"; // always use this style to access the new value // 2) print "Get: " . $obj->get( "DRAGON" ). "\n\n"; 2) defining SOME_CONSTANT before defining it with constmgr class e.g.: define( "DRAGON", "first DRAGON value" ); $obj =& new constmgr(); // this method call won't update the value $obj->set( "DRAGON", "DRAGON value" ); 2. example ================================= please check the example file in the same directory 3. author ================================= Svetoslav Marinov <svetoslav.marinov@gmail.com> He is studying computer sciences and technologies in technical university of Sofia, Bulgaria. He has also a master degree in Electrical Engineering department in same university. At this moment he works for a big hosting company. In his free time he works on http://devquickref.com - Developers' quick reference site which contains ( in future ) useful code snippets,tips,tricks etc. bugs,comments,improvements are always welcome. 4. credits ================================= I was inspired to made this class when checking php's online docs at http://www.php.net/manual/en/language.variables.variable.php ************************** example ************************** rafael at fuchs inf br 21-Mar-2005 11:08 You can use constants in variable variables, like I show below. This works fine: <? define("TEST","Fuchs"); $Fuchs = "Test"; echo TEST . "<BR>"; echo ${TEST}; ?> output: Fuchs Test ************************** example ************************** 5. conclusion ================================= when accessing constants with style like this one ${DRAGON} may be a little bit annoying for you but it is a matter of choice. if you find this package useful use it. all the best! Svetoslav |
Files |
File | Role | Description |
---|---|---|
README-BG.TXT | Doc. | Readme file (Bulgarian Version) |
constmgr-example.php | Example | example file for constant management class |
constmgr.class.php | Class | constant management class |
README.TXT | Doc. | readme file for constant management class |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
User Ratings | User Comments (2) | |||||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.