Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- back slashes and preg_replace's e modifier
November 5, 2005, 10:29 pm
rate this thread
The output is \ and this doesn't make a lot of sense to me.
Since \'s in strings are interpreted as single 's, the above sprintf
parameter is equal to \. The following scripts output confirms this:
Attempting to run the output of the second script (as done in the next
script), however, results in a syntax error:
The fact that a syntax error would result isn't particurarly surprising
since the last ' is being escaped. What is surprising, however, is
that the last script yields a syntax error whereas the first script
doesn't. Any ideas as to why?
Re: back slashes and preg_replace's e modifier
Oli Filth wrote:
The order of the arguments is actually intentional. I'm trying to
replace the empty string (the third argument) with that which the
second argument would output when ran (as per the e modifier).
The following demonstrates that replacement should be taking place: