Jump to content

putting IF() arguments in a var


M.O.S. Studios

Recommended Posts

hey guys,

 

  is it possible to place a if() statement's argument in a variable, for example

 

$test="1<=2;";

if($test){echo "it works";}else {echo "it doesn't work";}

 

that will display "it works"

 

but

 

$test="3<=2;";

if($test){echo "it works";}else {echo "it doesn't work";}

 

will display "it doesn't work"

 

I'm assuming if I place the entire if statement in an variable then run it threw eval(); it will work, but i rather not do that.

Link to comment
https://forums.phpfreaks.com/topic/154507-putting-if-arguments-in-a-var/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.