//str_repeat — 重复一个字符串
$str='admin';
echo str_repeat($str , 10);
echo '<hr>';
//随机打乱一个字符串
$str = "0~99";
$shuffled = str_shuffle($str);
echo $shuffled;
echo '<hr>';
//str_split 字符串转数组
$str = "Hello Friend";
$arr1 = str_split($str);
//可以选择数组转换的长度 默认是1;
//str_split(字符串, 返回数组的的长度)
$arr2 = str_split($str, 5);
printf('<pre>%s</pre>',print_r($arr1,true));
printf('<pre>%s</pre>',print_r($arr2,true));
//md5 加密为32位
$str='1223456';
echo md5($str).'<br>';
echo '加密位数:'. strlen(md5($str));
echo '<hr>';
//sha1 加密为40位
$str='1223456';
echo sha1($str).'<br>';
echo '加密位数:' .strlen(sha1($str));
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!