$array=array("Linux","Apache","MySQL","PHP");
print_r(array_keys($array)); //返回所有键名
//Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 )
print_r(array_keys($array,"PHP")); //返回值为PHP的键名
//Array ( [0] => 3 )
print_r(array_values($array)); //返回所有键值
//Array ( [0] => Linux [1] => Apache [2] => MySQL [3] => PHP )
print_r(array_reverse($input)); //将数组颠倒,不保留键名
//Array ( [0] => PHP [1] => MySQL [2] => Apache [3] => Linux )
print_r(array_reverse($input,true)); //将数组颠倒,保留键名
//Array ( [3] => PHP [2] => MySQL [1] => Apache [0] => Linux )
已有 0 条评论