Isset and PHP Global Variable

Posted by justjoe on Stack Overflow See other posts from Stack Overflow or by justjoe
Published on 2010-04-03T14:17:07Z Indexed on 2010/04/03 14:23 UTC
Read the original article Hit count: 507

Filed under:
|

i have doubt on this particular problem : Global variabe initiation. i got this code and has global variable named conditional_random here :

function hello_testing() {
  global $conditional_random;
  if (isset($conditional_random)) {
      echo "foo is inside";  
  }

}

As it's name, the global variable (conditional_random) can be or not initiate before the hello_testing function been called.

So, what happen to my validation via isset() when $conditional_random is not initiate before the hello_testing function ? will it failed to check or it will always be true cause by the 'global' ?

© Stack Overflow or respective owner

Related posts about php

Related posts about php-basic