Jump to content
TAV1702

Off Topic Code Question

Recommended Posts

So I am messing with some code to bring it up to snuff with php 7 needs. I have pretty :much got it all good to go but 1 line. Literally, 1 line.

$message .= str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig, \$repl, '\\0')", '>' . $seg . '<'), 1, -1));

This code as we know just by looking at it is a pile of errors waiting to happen.I get the following error exactly as I had suspected I should.

Quote

Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

Now I have used the callback and everything in between and I get errors no matter what. The odd part is I have fixed no less than 25 of these in this code i am working on. However, this one is just sticking a boot in my @ss. I am not sure wh=y I can not get this one line out of all of them to work. It is probably something so simple and right under my nose. I have been working all night while laying in bed in the hospital and probably have just done to much for the night/day and just need to stop and ask like I have done here.

What say ye code gurus?

Share this post


Link to post
Share on other sites

What are the errors? And what exactly are you trying to do? That is a nasty regex :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×