PHP settype() Function

PHP settype() Function


PHP | settype() Function


The settype() function is a built-in function in PHP. The settype() function is used to the set the type of a variable. It is used to set type or modify type of an existing variable.

Syntax:

boolean settype($variable_name, $type)

Parameters: The settype() function accepts two parameters as shown in above syntax and are described below.

  1. $variable_name: This parameter specifies the name of variable
    whose type we want to modify. This parameter can be of any type that is, it can be of integer type or a string type etc.