Re: Arrays misbehaving!

From: Date: Sat, 31 Aug 2002 00:15:45 +0000
Subject: Re: Arrays misbehaving!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114713@lists.php.net to get a copy of this message
On Fri, 30 Aug 2002, Cameron Thorne wrote: > I was hoping I could access by either name OR number, but apparently not. Just for kicks ... here's something pretty ugly (I'd never use it), but neat if you're interested (or somehow really have your heart set on using integers). There are probably a handful of other ways to do this: $test = array ( 'a' => 'A', 'b' => 'B', 'c' => 'C'); $test_keys = array_keys( $test ); print $test[$test_keys[2]]; // Prints "C" - Same as print $test['c']; ~Chris

« previous php.general (#114713) next »