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;

Thanks in advance for any suggestions.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to