php.js : is_callable() function

is_callable() function

The is_callable() function is used to test whether a variable is callable or not. The function returns true if the variable is callable otherwise false.




is_callable(var_name, syntax_only, callable_name)


Name Description Required /
var_name Either the name of a function stored in a string variable, or an object and the name of a method within the object. Required Mixed*
syntax_only If set to TRUE, the function only verifies if it is a function or a method. It rejects simple variables those are not strings and an array not having a valid structure. Optional Boolean
callable_name Receives a "callable name". This option is implemented only for classes. Optional String

*Mixed : Mixed indicates that a parameter may accept multiple (but not necessarily all) types.

Example of php.js is_callable() function:

In the following web document is_callable() function test whether a variable is a callable or not.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>php.js : is_callable() function example</title>
<script type="text/javascript" src="../../phpjs/variable/variable.min.js"> </script>
<h1 style="color: green">php.js : is_callable() function example</h1>
<h3>Returns true if the variable is callable.</h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
function test() {

View example of php.js is_callable() function in browser

Download phpjs.zip

Previous: php.js : is_bool() function
Next: php.js : is_double() function

Follow us on Facebook and Twitter for latest update.