[thelist] a PHP function question

misterhaan misterhaan at track7.org
Sun Feb 11 21:40:35 CST 2007

Bob Meetin wrote:
> function censor ($data)
>    {
>     if (eregi('[gambl]', $data)) { $message = "inappropriate content - submission denied"; $pass = "NO"; }
>     return $data;
>     echo "p: $pass<br>"; // this is just a test to see if the variable is set - and it fails.
>    }
> unfortunately calling the function doesn't return the $pass variable to 
> the form (either within the function or in the form).  what am i missing
the echo line will never get called since it's immediately after a 
return statement.
if you want $pass to have wider scope than just the function, just put 
"global $pass;" as the first line of your function.

More information about the thelist mailing list