note 49591 deleted from function.constant by vrana

From: Date: Tue, 20 Sep 2005 12:26:40 +0000
Subject: note 49591 deleted from function.constant by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-95472@lists.php.net to get a copy of this message
Note Submitter: thisisroot at gmail dot com ---- FYI, this function works with class constants too. Below is an example in which a database abstraction layer creates connections to different relational database systems based on class constants such as DBFission::CONNECTION_MYSQL, DBFission::CONNECTION_POSTGRESQL, etc. Using this function, I can convert text in an INI file to an integer constant easily. <?php // php voodoo to get a class constant based on a string $type = constant( 'DBFission::CONNECTION_' . strtoupper( $c[ 'type'])); ?>

« previous php.notes (#95472) next »