Hi Andre, You could've just tried it yourself;)
$list = array( 'a'=>'string key', utf8_encode('รค')=>'unicode key', //will be treated as an ascii-string 10=>'int key', 2.2=>'float key', //will be cast to an int(2) null=>'null key', //will be cast to a string(0) "" true=>'boolean key', //will be cast to an int(1) ); class B { } $f = fopen('/tmp/x','r'); $list[$f] = 'resource key'; //$f will be cast as an int(x) $list[new B()] = 'object key'; //yields an "illegal offset type" notice foreach( $list as $key => $value ) { echo $value .': '; var_dump($key); } Am 31.07.2011 04:18, schrieb Andre:
Question to someone who's familiar with how arrays are implemented in PHP. I've tried asking this on stackoverflow.com, but it looks like I need to ask this one to people familiar with PHP source. PHP manual says that one should only use strings or integers as array keys. Also I know that PHP doesn't speak unicode yet. So - I was just wondering - when unicode characteres are used in array key - does PHP strips them or affects them in any way? or does iPHP simply treats keys as binary string, the end of the story? Thank you!
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php