Hướng dẫn dùng typeof variable trong PHP
❮ PHP Variable Handling Reference Show Nội dung chính
ExampleReturn the type of different variables: $a = 3; $b = 3.2; $c = "Hello"; $d = array(); $e = array("red", "green", "blue"); $f = NULL; $g = false; Try it Yourself » Definition and UsageThe gettype() function returns the type of a variable. SyntaxParameter Values
Technical Details
❮ PHP Variable Handling Reference (PHP 4, PHP 5, PHP 7, PHP 8) gettype — Get the type of a variable Descriptiongettype(mixed Parametersvalue The variable being type checked. Return ValuesPossible values for the returned string are:
Changelog
ExamplesExample #1 gettype() example
= array(1, 1., NULL, new stdClass, 'foo'); The above example will output something similar to: integer double NULL object string See Also
Anonymous ¶ 7 months ago
What is the use of Settype () and Gettype () function in PHP?The gettype() function gets the type of variable; gettype() is a function that display a data type. The settype function sets the type of variable; the settype() function changes the data type. What is get type function do?The gettype() function returns the type of a variable. What is $_ GET variable?PHP $_GET is a PHP super global variable which is used to collect form data after submitting an HTML form with method="get". $_GET can also collect data sent in the URL. Assume we have an HTML page that contains a hyperlink with parameters: How do you convert one variable type to another in PHP?PHP settype() Function The settype() function converts a variable to a specific type. |