|
Posted by gosha bine on 05/29/07 18:27
Giovanni R. wrote:
> Take a look at this code (you can execute it):
>
> error_reporting(E_ALL);
>
> function byVal( $v) {}
> function byRef(&$v) {}
>
> print '<pre>';
>
> byVal ($first['inexistent_index']); // gives a notice
> var_dump($first); // gives a notice
>
> print '<hr />';
>
> byRef ($second['inexistent_index']); // does NOT give a notice
> var_dump($second); // does NOT give a notice
>
> print '<hr />';
>
> isset($third); // does NOT give a notice
> var_dump ($third); // gives a notice
>
> print '</pre>';
>
>
> In the $first case, using byVal(), I get *two* notices.
> In the $second case, using byRef(), I get *zero* notice.
> In the $third case, using isset(), I get *one* notice.
>
> This means that:
>
> 1) byVal() does NOT define the array and raises a notice
> (and var_dump() raises another notice).
>
> 2) byRef() defines the array and does NOT raise notices
> (neither var_dump() raises a notice, since $second is defined).
>
> 3) isset() does NOT define the array and does NOT raise notices
> (but var_dump() raises a notice, since $third is NOT defined).
>
> As you can see, isset() is weird, and I need to emulate its behaviour.
>
> The question is: is it possible to do that in PHP?
>
> Greetings, Giovanni
>
>
Hi
what exactly is the desired behaviour of that new, emulated isset?
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Navigation:
[Reply to this message]
|