$foo = "5bar"; / / string $bar = true; / / boolean settype($foo, "integer"); / / $foo is now 5 (integer) settype($bar, "string"); / / $bar is now "1" (string)
settype() renvoie TRUE en cas de succès, FALSE sinon.