note 98009 deleted from function.key by danbrown
| From: | danbrown@php.net | Date: | Thu, 20 May 2010 15:43:25 +0000 |
| Subject: | note 98009 deleted from function.key by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-169456@lists.php.net to get a copy of this message | ||
Note Submitter: bulimaxiu at op dot pl
Reason: 2
----
Problem with classes, when extrasing key:
<?
class klasa {
function __construct($id_polaczenia_get=Null) {
$this->config['local'] = Array ('key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3');
}
function demo ($par=Null) {
if ($par==Null) {
$par = key ($this->config); // should get 'local' key
}
In this situation $par = Null instead of 'local'. After simple change:
function demo ($par=Null) {
if ($par==Null) {
$___something = $this->config;
$par = key ($this->config);
}
it return properly key: 'local'.