for()无循环体,在for中直接运行代码的结果为什么不一样?这两种运行方式有什么区别吗?
function createCode ( $a )
{
for($f = 0 ;$f < 8 ;$f ++) {
$a = md5 ( $a , true ) ;
$s = '0123456789ABCDEFGHIJKLMNOPQRSTUV' ;
$d = '' ;
$g = ord ( $a[ $f ] ) ;
$d .= $s[ ( $g ^ ord ( $a[ $f + 8 ] ) ) - $g & 0x1F ] ;
};
return $d;
}
var_dump(createCode('jakljfklasdjfkldsf'));
//输出4
function createCode ( $a )
{
for
(
$a = md5 ( $a , true ) ,
$s = '0123456789ABCDEFGHIJKLMNOPQRSTUV' ,
$d = '' ,
$f = 0 ;
$f < 8 ;
$g = ord ( $a[ $f ] ) ,
$d .= $s[ ( $g ^ ord ( $a[ $f + 8 ] ) ) - $g & 0x1F ] ,
$f ++
) ;
return $d;
}
var_dump(createCode('jakljfklasdjfkldsf'));
//输出PPMLAP01
这两种方式有什么区别吗?
HappyX
9 years, 8 months ago