PHP တွင်သင်သည် variable အမျိုးအစားကိုစစ်ဆေးလိုပါက GetType () function ကိုသုံးနိုင်သည်။ ၎င်းသည် variable အမျိုးအစားကိုကိုယ်စားပြုသည့် string ကိုပြန်ပို့သည်။
GetType () function ကိုမှပြန်လာသော string ကို Type တွင် -
$x = 10;
$y = "Hello";
$z = true;
echo "Type of $x: " . gettype($x) . "<br>";
echo "Type of $y: " . gettype($y) . "<br>";
echo "Type of $z: " . gettype($z) . "<br>"; Type of $x: integer
Type of $y: string
Type of $z: booleanGetType () function ကိုအသုံးပြုခြင်းအားဖြင့်သင်သည် PHP တွင် variable များကိုအလွယ်တကူဆုံးဖြတ်ရန်နှင့်ထုတ်လွှင့်နိုင်သည်။ ၎င်းသည် debugging နှင့် data processing အတွက်အသုံးဝင်သည်။ ဤနည်းလမ်းကိုကျွမ်းကျင်ခြင်းသည်တီထွင်သူများသည် variable များနှင့် debug code ကိုပိုမိုထိရောက်စွာစီမံခန့်ခွဲနိုင်သည်။