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

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

WBOY
Release: 2016-06-13 10:36:15
Original
904 people have browsed it

为什么用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);
Copy after login

结果: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>
Copy after login
Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template