annuity Posted April 24, 2011 Share Posted April 24, 2011 Hi, Since upgrading to php 5.3 i have a line of code on my site that is giving me a depreciated error. The line of code is as follows: $data=eregi_replace(">"."[[:space:]]+"."<","><",$data); I've got as far as knowing i need to change it from eregi_replace to preg_replace but i can't for the life of me work out where to put any backslashes etc, if any. Is there a formula for working this type of thing out? Every example i see has backslashes and $1's all over the place. Do i simply do this "/ and this /" after and before every double quote? Or is it not as simple as that? Things never are are they! Please could an expert on here offer me any assistance. This is an important line of code(i think) so i didn't want to experiment as i would normally do, i need to get this right first time as i don't know what will happen if i get this wrong. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/234552-help-needed-converting-eregi_replace-function-to-preg_replace-for-php-53/ Share on other sites More sharing options...
annuity Posted April 24, 2011 Author Share Posted April 24, 2011 No way google has indexed this thread already! wow! I was searching for a formula to work out where to put the backslashes and the first result is this thread! To be honest that doesn't bode well for me being able to find a formula for newbies like myself to try and work out how to convert the function but i'll keep going. If anyone can help me convert this line of code to preg_replace it would be much appreciated. $data=eregi_replace(">"."[[:space:]]+"."<","><",$data); I'm thinking along the lines of $data=preg_replace("/>/"."/[[:space:]]+/"."/</","/></",$data); but i'm not sure and as i say i need to get this right. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/234552-help-needed-converting-eregi_replace-function-to-preg_replace-for-php-53/#findComment-1205420 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.