وظيفة ضبط PHP ()
مثال
تحويل المتغيرات إلى أنواع محددة:
<?php
$a = "32"; // string
settype($a, "integer"); // $a is now integer
$b = 32;
// integer
settype($b, "string"); // $b is now string
$c = true; //
boolean
settype($c, "integer"); // $c is now integer (1)
?>
التعريف والاستخدام
تعمل وظيفة () على تحويل متغير إلى نوع معين.
بناء الجملة
settype(variable, type);
قيمه المعامل
Parameter | Description |
---|---|
variable | Required. Specifies the variable to convert |
type | Required. Specifies the type to convert variable to. The possible types are: boolean, bool, integer, int, float, double, string, array, object, null |
تفاصيل تقنية
قيمة الإرجاع: | صواب في النجاح ، خطأ في الفشل |
---|---|
نوع الإرجاع: | قيمة منطقية |
إصدار PHP: | 4.0+ |
❮ مرجع معالجة متغير PHP