Moh*_*mad 5 php coding-style function
做这个
function doThings(){
if($oh){
return $oh;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
等于这个
function doThings(){
if($oh){
return $oh;
}else{
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
是的,两者都是一样的.就个人而言,我更喜欢在同一个地方退出一个功能.例如
function doThings(){
$flag = false;
if($oh){
$flag = $oh;
}
return $flag;
}
Run Code Online (Sandbox Code Playgroud)