PHP is_callable () फ़ंक्शन
उदाहरण
जांचें कि किसी चर की सामग्री को फ़ंक्शन के रूप में बुलाया जा सकता है या नहीं:
<?php
function test1(){
}
echo "test1 is callable: " . is_callable("test1");
echo "<br>";
echo "test2 is callable: " . is_callable("test2");
?>
परिभाषा और उपयोग
is_callable () फ़ंक्शन यह जांचता है कि किसी चर की सामग्री को फ़ंक्शन के रूप में कहा जा सकता है या नहीं।
यह फ़ंक्शन सत्य लौटाता है (1) यदि चर कॉल करने योग्य है, अन्यथा यह गलत/कुछ भी नहीं देता है।
वाक्य - विन्यास
is_callable(variable, syntax_only, name );
पैरामीटर मान
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
syntax_only | Optional. If set to TRUE, the function only verifies if variable is a function or method. It will reject variables that are not strings, or arrays without a valid structure to be used as a callback. Default is false |
name | Optional. Returns a "callable name" (only for classes) |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | TRUE यदि वेरिएबल कॉल करने योग्य है, FALSE अन्यथा |
---|---|
वापसी का प्रकार: | बूलियन |
पीएचपी संस्करण: | 4.0.6+ |
PHP वैरिएबल हैंडलिंग संदर्भ