Daevid Vincent wrote: > *sigh* > > Why is PHP so lame... you know the story about the bad workman and his tools? please go and read the manual entry regarding how to reference class constants.
> > <?php > class PHPISLAME > { > const STOP = 0; > const START = 1; > const PAUSE = 2; > > public static $STATES = array( > STOP => 'Stopped', > START => 'Started', > PAUSE => 'Paused' > ); > > public static $STATESHACK = array( > 0 => 'Stopped', > 1 => 'Started', > 2 => 'Paused' > ); > } > > print_r(PHPISLAME::$STATES); > > print_r(PHPISLAME::$STATESHACK); > ?> > > What is this crap!!?: what that crap is would be self evident if you bothered to turn on E_NOTICEs in your error_reporting. (hint: what does php do with undefined constants?) > Array ( [STOP] => Stopped [START] => Started [PAUSE] => Paused ) > > Array ( [0] => Stopped [1] => Started [2] => Paused ) > oh would you look at this .... $> php -v PHP 5.1.4-pl0-gentoo (cli) (built: Jul 5 2006 18:26:03) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies ?> php -r 'class Test {const MYTEST = 3;public static $S = array( Test::MYTEST => "TEST" );}var_dump(Test::$S);' array(1) { [3]=> string(4) "TEST" } ... now take a deep breath and relax :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php