<?php $my_array = array("a" => "Dog", "b" => "Cat", "c" => "Horse"); //=>区分键值 sort($my_array);//对数组进行排序 print_r($my_array); ?>
<?php $my_array = array( "Dog", "Cat","Horse","Dog"); print_r(array_count_values($my_array)); ?>//排序
<?php $my_array = array( "Dog", "Cat","Horse","Dog"); print_r(array_unique($my_array)); ?>//删除数组中重复的数据
<?php $my_array = array( "Dog", "Cat","Horse","Dog"); $count = count($my_array); print_r($count); ?>//统计数组中元素的个数
<?php $my_array = array(0=>"2" ,1=>"4"); $ss = array_sum($my_array); echo($ss) ?>//计算数组内的和
时间: 2024-11-07 23:20:11