What can I use instead?

From: Date: Sun, 06 Jan 2002 15:15:56 +0000
Subject: What can I use instead?
Groups: php.general 
Request: Send a blank email to php-general+get-79609@lists.php.net to get a copy of this message
Hi I am writing a piece of code that uses contstant names that are dynamic. My first solution was to use the constant() function from within PHP. My problem now is that the code needs to be compatible with PHP 3.018 and early versions of PHP 4. Can anyone offer a better way of doing things? My current code is $expected_result = 0; for ($i = 1; $i <= $this->total_num; $i ++) { $information = constant('CONS_' . $i); $information_2 = split("[,]", $information); if ( in_array($expected_result, $information_2) ) { $expected_result = $i; break; } } Thanks in advance for any suggestions. Mark

« previous php.general (#79609) next »