Jump to content

Need help with eval


Recommended Posts

I am trying to eval if condition but for somereason ""itworks" never gets printed. When you call my_if(true||false); directly, it'll return true but not when you eval code.Does anyone know how to eval expression of trues and falses to get only 1 true or false?

<?phpfunction my_if($cond){    return $cond;}if(eval("my_if(true||false);")){    print("itworks\n");}?>

Examples (let T be true and F be false):T||T shall give TT||F shall give TT&&(T||F) shall give T since (T||F) is T therefore T &&T is T

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...