PHP Functions
PHP Functions are a useful tool to use while writing a program, they help in separating the programming logic into smaller modules which can be called and executed individually. This helps in reusability of code and also makes the application easier to understand as it is split into small chunks of functional logic.
A php function is a piece of code that performs a specific task and returns some value. Functions are declared by using a keyword ‘function’ followed by an open and closed parenthesis. It is possible to pass multiple parameters along with the function call, which are used for passing inputs during the runtime.
The php function is_double() checks if the given variable has the float data type or not. It is an alias for the is_float() function.
There are many other functions in PHP that can check the data type of a variable, for example: get_resource_type(), set_type(), interval(), floatval(), boolval(). The get_resource_type() and set_type() functions return a string if the data passed is not in the intended data form. The interval() and floatval() function converts the variable data to integers or floating point numbers respectively.
Another function that can check the data type of a string is count_chars(). This function returns a list of all the different characters in a string. It is often used to analyse and debug a string.