| settype() | ใช้กำหนด ชนิดข้อมูลใหม่ ให้กับตัวแปร |
|---|
function:settype ( varname, new_type );
return type:void, boolean
content:ใช้กำหนด ชนิดข้อมูลใหม่ ให้กับตัวแปร และจะคืนค่า true กลับมาถ้าหากว่าเปลี่ยนชนิดตัวแปรสำเร็จ
example:$num = 1.234; settype ( $num, "integer" );
comment:นอกจากนี้ยังมีอีกวิธีหนึ่งในการแปลงชนิดตัวแปร คือวิธีการ casting ดังนี้ ( type ) varname; เช่น ( integer ) $num;