PHP’s base64_encode is returning a different string to the linux base64 command.
Why is this?
PHP:
$ php
<?php
echo base64_encode('test');
?>
dGVzdA==
Linux base64:
$ echo 'test' | base64
dGVzdAo=
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
echousually outputs a new line character at the end of the string, to suppress that use the-nswitch:Or even better, use the portable
printf:Similarly for PHP: