You just don't use @$ary[$elm] to write that kind of function since
you need to detect if the index is set or not and return default value
accordingly.

> Of course if you use symfony, you're simply passing the use of both
> this construct:
>  (isset($ary[$elm])) ? $ary[$elm] : null
> and this one:
>  @$ary[$elm]
> to someone else's code :-)

I said "I prefer $something = $request->getParameter('something');",
referring to the kind of function/method/class I prefer to use.

On Thu, Sep 17, 2009 at 8:05 AM, craiganz <[email protected]> wrote:
>
> Hi,
> Certainly an alternative way to write clean code is to use symfony or
> simply to always use your own function to hide the ugliness of this:
>
>        function getArrayElem($ary, $elm, $def=null) {
>                return (isset($ary[$elm])) ? $ary[$elm] : $def;
>        }
>
> Of course if you use symfony, you're simply passing the use of both
> this construct:
>  (isset($ary[$elm])) ? $ary[$elm] : null
> and this one:
> �...@$ary[$elm]
> to someone else's code :-)
>
> Try:
> error_reporting( E_ALL | E_STRICT | E_NOTICE );
>
> Neither E_ALL (warnings and errors only) or E_STRICT (forward
> compatibility) turns on notices.  The construct being used isn't
> deprecated, nor is it an error :-)
>
> -Craig
>
>
> On Sep 16, 7:43 pm, Sid Bachtiar <[email protected]> wrote:
>> Sure, I'm not arguing for the user of @ either. I use Symfony, I don't
>> even use $_GET anymore. I prefer $something =
>> $request->getParameter('something');
>>
>> By the way, I tried the following and it did not raise any error (php 5.26)
>>
>> <?php
>> error_reporting( E_ALL | E_STRICT );
>> $something = @$_GET['something'];
>>
>
> >
>



-- 
Blue Horn Ltd - System Development
http://bluehorn.co.nz

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to