Home > php教程 > php手册 > PHP 编码规范(26)

PHP 编码规范(26)

WBOY
Release: 2016-06-13 10:21:03
Original
1017 people have browsed it

9.3.3 返回值

设法让你的程序结构符合目的。例如:
if (booleanExpression) {
  return true;
} else {
  return false;
}

应该代之以如下方法:
return booleanExpression;

类似地:
if (condition) {
  return x;
}
return y;

应该写做:
return (condition ? x : y);


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template