Jump to content

base64_encode


jakebur01

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.