PHP gettype() Function

PHP intval() Function
PHP get_resource_type() Function

In this article, you will learn how to get the type of variable in PHP. The gettype() function in PHP returns the type of a variable.

what is the syntax of the GETTYPE() function in php?

gettype(variable);
ParameterDescription
variableRequired. Specifies the variable to check
PHP GETTYPE() method

examples of the GETTYPE() function

Example 1. In this example, we get the type of different variables.

<?php
$a = 3;
echo gettype($a) . "<br>";

$b = 3.2;
echo gettype($b) . "<br>";

$c = "Hello";
echo gettype($c) . "<br>";

$d = array();
echo gettype($d) . "<br>";

$e = array("red", "green", "blue");
echo gettype($e) . "<br>";

$f = NULL;
echo gettype($f) . "<br>";

$g = false;
echo gettype($g) . "<br>";
?>
PHP intval() Function
PHP get_resource_type() Function
en English
X
Scroll to Top