Home >Backend Development >PHP Tutorial > 为何用sort对数组排序得到的结果=1

为何用sort对数组排序得到的结果=1

WBOY
WBOYOriginal
2016-06-13 13:24:181005browse

为什么用sort对数组排序得到的结果=1

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
$a  =  array(2,4,1,3,7,5);
$a  = sort($a);
print_r($a);



结果:1;
百思不得其解!求解!!!

------解决方案--------------------
1 表示排序成功

------解决方案--------------------
PHP code
$a  =  array(2,4,1,3,7,5);
echo sort($a);
print_r($a);
<br><font color="#e78608">------解决方案--------------------</font><br>sort()是取地的,返回的是是否成功,true==1,所以你应该输出$a <div class="clear">
                 
              
              
        
            </div>
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