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. 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. 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? 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. 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
Archived
This topic is now archived and is closed to further replies.