#以前多个变量赋值你可以这样写
$a = 1;
$b = 2;
$c = 4;
#或者相同值的你可以这样写
$a = $b = $c = [];
#现在你可以这样为不同值的多个变量赋值
[$a, $b, $c] = [1, 2, 3];
`#以前用mcrypt写一个加密大概是这样
public function encryptData($str, $key)
{
$block = mcrypt_get_block_size('des', 'ecb');
$pad = $block - (strlen($str) % $block);
$str .= str_repeat(chr($pad), $pad);
$res = mcrypt_encrypt(MCRYPT_DES, $key, $str, MCRYPT_MODE_ECB);
return strtoupper(bin2hex($res));
}
#现在你需要用openssl来替换了
public function encryptData($str, $key)
{
$res = openssl_encrypt($str, 'DES-ECB', $key, OPENSSL_RAW_DATA);
return strtoupper(bin2hex($res));
}
#以前用mcrypt写一个解密大概是这样
public function decryptData($str, $key)
{
$str = strtolower($str);
$str = pack('H*', $str);
$decrypted = mcrypt_decrypt(MCRYPT_DES, $key, $str, MCRYPT_MODE_ECB);
$dec_s = strlen($decrypted);
$padding = ord($decrypted[$dec_s - 1]);
$decrypted = substr($decrypted, 0, -$padding);
return $decrypted;
}
#现在也要用openssl替换了
public function decryptData($str, $key)
{
$str = strtolower($str);
$str = pack('H*', $str);
$decrypted = openssl_decrypt($str,'DES-ECB', $key,OPENSSL_RAW_DATA);
return $decrypted;
}`
`# 以前可以这样
$num = 1 + 'abc323vccc'; //result 1;
$num = 1 +'100abc'; //result 101;
#现在你不能那样写了,将会得到这样的一个警告
PHP warning: A non-numeric value encountered on line 1```