note 98009 added to function.key

From: Date: Thu, 20 May 2010 13:00:46 +0000
Subject: note 98009 added to function.key
Groups: php.notes 
Request: Send a blank email to php-notes+get-169447@lists.php.net to get a copy of this message
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'. ---- Server IP: 194.24.174.37 Probable Submitter: 83.11.33.234 ---- Manual Page -- http://www.php.net/manual/en/function.key.php Edit -- https://master.php.net/note/edit/98009 Del: integrated -- https://master.php.net/note/delete/98009/integrated Del: useless -- https://master.php.net/note/delete/98009/useless Del: bad code -- https://master.php.net/note/delete/98009/bad+code Del: spam -- https://master.php.net/note/delete/98009/spam Del: non-english -- https://master.php.net/note/delete/98009/non-english Del: in docs -- https://master.php.net/note/delete/98009/in+docs Del: other reasons-- https://master.php.net/note/delete/98009 Reject -- https://master.php.net/note/reject/98009 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#169447) next »