My question is now about the "global" command (command?) in PHP. I saw this used:
Code: Select all
global $var
$var="Hello";Cheers!
P.S. I'm asking this because I couldn't find it in the PHP manual. Perhaps I just didn't look hard enough
Moderator: General Moderators
Code: Select all
global $var
$var="Hello";Code: Select all
<?php
function changebob()
{
global $name;
$name = "i am not bob";
}
$name = "bob";
changebob();
echo($name);
?>Code: Select all
<?php
function checkemail($var)
{
// check if $var is valid
return true // or false depending on result
}
$is_email_valid = checkemail($email);
?>Code: Select all
<?php
function checkemail()
{
global $email
// check if $email is valid
return true // or false depending on result
}
$is_email_valid = checkemail();
?>