PHP localtime()ฟังก์ชั่น
ตัวอย่าง
พิมพ์เวลาท้องถิ่นเป็นดัชนีและเป็นอาร์เรย์ที่เชื่อมโยง:
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
ความหมายและการใช้งาน
ฟังก์ชัน localtime() ส่งกลับเวลาท้องถิ่น
ไวยากรณ์
localtime(timestamp, is_assoc)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
timestamp | Optional. Specifies a Unix timestamp that defaults to the current local time, time(), if no timestamp is specified |
is_assoc | Optional. Specifies whether to return an associative or indexed array. FALSE = the array returned is an indexed array. TRUE = the array returned is an associative array. FALSE is default.
The keys of the associative array are:
|
รายละเอียดทางเทคนิค
คืนมูลค่า: | ส่งกลับอาร์เรย์ที่มีส่วนประกอบของ Unix timestamp |
---|---|
รุ่น PHP: | 4+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 5.1: ตอนนี้ออกข้อผิดพลาดโซนเวลา E_STRICT และ E_NOTICE |
❮ PHP วันที่/เวลาอ้างอิง