Home  >  Article  >  Backend Development  >  php实现用三元运算符求三个数中的最大值,最小值

php实现用三元运算符求三个数中的最大值,最小值

WBOY
WBOYOriginal
2016-06-23 13:11:415013browse

$a = 12;$b = 26;$c = 10;//求三个数中的最大值:echo $a>$b?($a>$c?$a:$c):($b>$c?$b:$c);//求三个数中的最三小值;echo $a<$b?($a<$c?$a:$c):($b<$c?$b:$c);


Statement:
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