DC>> function some_generic_function($myarray)
DC>> {
DC>>   foreach ($myarray as $k => $v) {
DC>>     if (is_string($k)) {
DC>>       /* some behaviour for associative array element */
DC>>     }
DC>>     else {
DC>>       /* some behaviour for indexed array element */
DC>>     }
DC>>   }
DC>> }

Well, that's a bad code. Very bad. Why would you distinguish between
string and number keys? Anyway, there's no way (known to me) to do this in
PHP. If you tell me why would you need this, I could probably give some
advice (such as adding "k_" to each key, for example), but as a
theoretical example it just looks like "let's do something just because we
want, no matter that PHP is not meant to do that".

Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.115

PHP Development 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