kucing Posted July 1, 2008 Share Posted July 1, 2008 Hello all, I am trying to match something in my array with php file but it doesn't work. Here is the example: $file="if \(!\$emptymessage['member']['signature'] && \$emptyoptions['show_no_signatures']\)"; if ( preg_match( '%'.$file.'%si', $file, $output ) ) print_r($output); Any help will be very appreciated.. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/112707-preg_match-doesnt-work-with-php-file/ Share on other sites More sharing options...
Tchelo Posted July 1, 2008 Share Posted July 1, 2008 I believe php might be evaluating $emptymessage and $emptyoptions, as you have put it between double quotes. Not sure, though. Try switching double quotes to single quotes and vice-versa. Quote Link to comment https://forums.phpfreaks.com/topic/112707-preg_match-doesnt-work-with-php-file/#findComment-578807 Share on other sites More sharing options...
kucing Posted July 1, 2008 Author Share Posted July 1, 2008 Thanks for the reply Tehelo.. Actually I have even tried that way but it still doesn't work. So I was thinking if there is any other way to do that using other function than preg_match? Quote Link to comment https://forums.phpfreaks.com/topic/112707-preg_match-doesnt-work-with-php-file/#findComment-578830 Share on other sites More sharing options...
Tchelo Posted July 1, 2008 Share Posted July 1, 2008 Actually, I don't get what you are trying to do here in your code. You are trying to search $file in $file... Did you notice your search pattern variable is named $file, and you are searching this pattern in a variable named $file as well? If all this is correct, please explain a little further what you are trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/112707-preg_match-doesnt-work-with-php-file/#findComment-579052 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.