jakebur01 Posted March 30, 2007 Share Posted March 30, 2007 Hello, I have some code that I have to change '<?' to '<?php' for it to work. I have one part of the code that may be encoded base64_encode with the '<?' trapped inside. Is their a snippit of code I could insert to convert all of the code from '<?' to '<?php'? How do I fix this? Thanks, Jake Quote Link to comment https://forums.phpfreaks.com/topic/44924-base64_encode/ Share on other sites More sharing options...
Daniel0 Posted March 30, 2007 Share Posted March 30, 2007 str_replace('<?','<?php',$string); perhaps? I don't really see what base64 encoding has to do with changing <? to <?php... Quote Link to comment https://forums.phpfreaks.com/topic/44924-base64_encode/#findComment-218163 Share on other sites More sharing options...
obsidian Posted March 30, 2007 Share Posted March 30, 2007 str_replace('<?','<?php',$string); perhaps? I don't really see what base64 encoding has to do with changing <? to <?php... Just in case you have the string '<?' somewhere in your page that isn't actually a PHP tag, you could look to make sure that you have whitespace following the '<?' with a regexp lookahead: <?php $string = preg_replace('|\<\?(?=\s)|', '<?php', $string); ?> Quote Link to comment https://forums.phpfreaks.com/topic/44924-base64_encode/#findComment-218180 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.