ฟังก์ชัน gettype()
ความหมายของฟังก์ชันและการใช้งาน
ฟังก์ชัน gettype() จะ return ชนิดของตัวแปรกลับมา
รูปแบบการเขียน (Syntax)
gettype($y)
- $y คือ ชื่อตัวแปร
ชนิดของตัวแปร (Type)
boolean หรือ bool
integer
double
string
array
resource
null
unknown type
ตัวอย่าง
<?php
$y="10y";
$type_of_variable=gettype($y);
echo $type_of_variable;
?>
ผลลัพธ์
string