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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---