using string into if statment to return boolean

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smartic
    New Member
    • May 2007
    • 150

    using string into if statment to return boolean

    I need to use this string [PHP]"preg_match('$p attern','$value ')" [/PHP] to return boolean value in if statment how can i do that i used eval function put it give me this error (Parse error: syntax error, unexpected $end in : eval()'d code on line 1)
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Correction:
    [PHP] eval("return preg_match('$pa ttern','$value' );") [/PHP]

    Eval() will execute but you need to tell it to return something in the code. You got the error because you forgot the semicolon.


    Dan

    Comment

    Working...