Re: What is wrong with this code?
| From: | Gary . | Date: | Wed, 28 Apr 2010 07:03:27 +0000 |
| Subject: | Re: What is wrong with this code? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304697@lists.php.net to get a copy of this message | ||
Per Jessen wrote:
> Gary . wrote:
>> Calling it, the array_key_exists call always returns false
...
>> and I can't see what I've done wrong :(
>
> Might this be better:
>
> public static function getMessage($ec)
> {
> $text = '';
> if (array_key_exists($ec, $errors))
> {
> $text = $errors[$ec];
> }
>
> return $text;
> }
Well, not really...
1) Pg_Error_Test::testGetMessage_23505
array_key_exists() expects parameter 2 to be array, null given
(scope issue, I think - it assumes I am talking about a local $errors variable)
> Per Jessen, Zürich (11.2°C)
^^^^^^
Oh :) Maybe I should have just popped round and asked :))