gettypeGET the type of a
VARIABLE.
This function returns a
STRING, as type name, of a variable when it tests the following types:
STRING,
NUMERIC,
BOOLEAN,
ARRAY,
NULL,
RESOURCE or
OBJECT.
Although it looks practical, it is not recommended in situations involving redefinitions of variable values, with possible type changes.
The type of the same variable at a given time may not be the same as defined above.
Instantly, using one of the
is_* functions can be more reliable.
RESULT
NULL
NULL
integer
int(100)
array
array(3) { [0]=> int(2) [1]=> string(4) "alô" [2]=> string(5) "hello" }
boolean
bool(true)
string
string(33) "Quandoque bonus dormitat Homerus!"
double
float(0.63661977236758)
- - - - - - - - - - - - - - - - - - - - - - - - - -
PHP 7.4.XX
resource
resource(11) of type (gd)
or
PHP 8.0.XX
object
object(GdImage)#1 (0) { }
- - - - - - - - - - - - - - - - - - - - - - - - - -
object
object(nwteste)#1 (2) { ["var1"]=> string(23) "Isto é um objeto teste" ["var2"]=> string(21) "This is a test object" }
Isto é um objeto teste
This is a test object