note 49591 added to function.constant

From: Date: Wed, 02 Feb 2005 15:34:58 +0000
Subject: note 49591 added to function.constant
Groups: php.notes 
Request: Send a blank email to php-notes+get-84368@lists.php.net to get a copy of this message
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'])); ?> ---- Manual Page -- http://www.php.net/manual/en/function.constant.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49591 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49591&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49591&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49591&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49591&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49591&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49591&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84368) next »