PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Is the only way I can see if that statement evaluates to TRUE is through an eval() statement? The problem is that I can be running this statement through a foreach loop that can run for as long as 16000 iterations, and eval() seems to slow the execution time down tremendously. I need a workaround.
<?php
// The "i" after the pattern delimiter indicates a case-insensitive search
if (preg_match ("/php/i", "PHP is the web scripting language of choice.")) {
print "A match was found.";
} else {
print "A match was not found.";
}
?>
yea i understand that. But what if the preg_match() statement is inside of a string? How can i check to see whether it will evaluate to true, without using eval().
ChibiGuy wrote:yea i understand that. But what if the preg_match() statement is inside of a string? How can i check to see whether it will evaluate to true, without using eval().
Why is your preg_match() statement inside of a string?
becaause the function takes an array like array('id =~ %ab[^B]%', 'AND', 'name <> name') and tries to convert it to php code to test it against some information.
Is the only way I can see if that statement evaluates to TRUE is through an eval() statement? The problem is that I can be running this statement through a foreach loop that can run for as long as 16000 iterations, and eval() seems to slow the execution time down tremendously. I need a workaround