key();
ใช้งาน: echo key(); ==> Output: แสดงตำแหน่งของข้อมูลปัจจุบัน
current();
ใช้งาน: echo current(); ==> Output: จะแสดงข้อมูลที่ที่อยู่ปัจจุบัน
sort();
ใช้งาน: $arr=array(5,1,4,3,2); echo sort($arr); ==> Output: $arr =1,2,3,4,5
Ex.
<?php
$fruits = array (
"fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
"numbers" => array(1, 2, 3, 4, 5, 6),
"holes" => array("first", 5 => "second", "third")
);
echo print_r(); // แสดงค่าในอาเรย์
?> ;
Output:
Array (
[fruits] => Array (
[a] => orange
[b] => banana
[c] => apple
)
[numbers] => Array (
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
)
[holes] => Array (
[0] => first
[5] => second
[6] => third )
)
สร้างเมื่อวันที่ : 12-07-2548
[email protected]
การใช้ฟังก์ชั่น เกี่ยวกับอาเรย์
count();
ใช้งาน: $arr=array(1,2,3,4,5); echo "จำนวน=".count($arr); ==> Output: จำนวน=5