note 121940 rejected from function.rtrim by cmb

From: Date: Wed, 29 Nov 2017 15:19:18 +0000
Subject: note 121940 rejected from function.rtrim by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209254@lists.php.net to get a copy of this message
Note Submitter: amitmmc1 at gmail dot com ---- 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

« previous php.notes (#209254) next »