note 121941 deleted from function.rtrim by cmb
| From: | cmb@php.net | Date: | Wed, 29 Nov 2017 15:19:38 +0000 |
| Subject: | note 121941 deleted from function.rtrim by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209255@lists.php.net to get a copy of this message | ||
Note Submitter: amitmmc1 at gmail dot com
----
php version :
PHP 7.1.11 (cli) (built: Nov 14 2017 15:20:17) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
rtrim escape the last five character
Class GeneralFunction {
static $salt="6638029068";
static function encrypt($text) {
return base64_encode($text.self::$salt);
}
static function decrypt($text) {
return rtrim(base64_decode($text),self::$salt);
}
}
$text ="9015123000";
echo $encrypted=GeneralFunction::encrypt($text); //output OTAxNTEyMzAwMC02NjM4MDI5MDY4
echo GeneralFunction::decrypt($encrypted);//output 90151 but expected output is 9015123000