By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,742 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,742 IT Pros & Developers. It's quick & easy.

using string into if statment to return boolean

P: 150
I need to use this string [PHP]"preg_match('$pattern','$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)
Oct 28 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,584
[PHP] eval("return preg_match('$pattern','$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.

Oct 29 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.