Vinze Posted December 23, 2006 Share Posted December 23, 2006 Hey, I want to use preg_replace() to replace all instances of <? with <?php. I can't do this with str_replace() because when I [i]do[/i] use <?php it would be converted to <?phpphp. I tried the following pattern:[code][<\?(!(php))][/code]But that doesn't work. Please help me, thanks in advance.[b]Edit:[/b] And I learned something new today: lookaheads. The correct code was:[code][<\?(?!php)][/code] Quote Link to comment 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.