I misexplain myself I think..

What I'm looking for is : a function that will :
1- check if the $variable exist (isset)
2- return the $variable if isset
3- return something (false) if is not set

that way, you don't get undefined variable call.
Those that function already exist in cakePHP, I've seen it in some CMS
and that was pretty useful.
------------

On Feb 13, 5:06 pm, "fr3nch13" <[EMAIL PROTECTED]> wrote:
> yeah, isset();
>
> if you wanna use your function in your post, you could rewite it like:
>
> function exist($var)
> {
>    return isset($var);
>
> }
>
> which again would be the equivalent of just using isset() anyways
>
> On Feb 13, 10:42 am, "DaddyCool78" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello to all the devs in here! I'm happy to have found this project,
> > as it is really useful/impressive ^_^
>
> > I recently started creating/modifying apps and I was looking for a
> > function that would look up for the existence of a x $variable .
>
> > Exemple, there is frequently in Views something like :
> > if ($error): ......
>
> > problem is when the $error is not set (using AJAX form fill, etc.) . I
> > was wondering if a function that I don't know the name yet would do
> > something like this :
>
> > function exist($var)
> > {
> >   if (isset($var)) {
> >     return $var;
> >   }else{
> >     return false;
> >   }
>
> > }
>
> > A simple way to check the existence of a variable and avoid the
> > messages like 'xxx variable could not be found.....'
>
> > David- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to