| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Using a variable for an "if "condition|
is this possible?
Is there any way to have a condition for an if statement be evaluated according to its contents and not whether the variable is defined or not? In other words:
$a = 'no';
$the_condition = '$a == "yes"';
echo "$a is equal to yes";
echo "$a is not equal to yes";
This will always evaluate as true and print yes because $the_condition variable is defined.
Is there any syntax so that I can have it actually evaluate the condition within the variable and whether that is true or not?
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved