Jump to content

preg_match doesn't work with php file?


kucing

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.