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 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... 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); ?> Link to comment https://forums.phpfreaks.com/topic/44924-base64_encode/#findComment-218180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.