पीएचपी सेटटाइप () फ़ंक्शन
उदाहरण
चर को विशिष्ट प्रकारों में बदलें:
<?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 |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | सफलता पर सत्य, असफलता पर असत्य |
---|---|
वापसी का प्रकार: | बूलियन |
पीएचपी संस्करण: | 4.0+ |
PHP वैरिएबल हैंडलिंग संदर्भ