PHP
php.net › manual › en › function.gettype.php
PHP: gettype - Manual
<?php $data = array(1, 1., NULL, new stdClass, 'foo'); foreach ($data as $value) { echo gettype($value), "\n"; } ?>
Call: +917738666252
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
IncludeHelp
includehelp.com › php › gettype-function-with-example.aspx
PHP gettype() Function (With Examples)
<?php // Creating variables with random datatype $var1 = 1; $var2 = 1.1; $var3 = null; $var4 = "example"; $var5 = false; // using gettype() function to // get the data type of the variable echo gettype($var1) . "\n"; echo gettype($var2) . "\n"; echo gettype($var3) .
Tutorialspoint
tutorialspoint.com › php › php_gettype_function.htm
PHP Variable Handling gettype() Function
So the program opens a file (resource) first and checks its type, closes it and then checks the type again. It also checks a NULL variable. <?php // Open a file (resource) $file = fopen("/PHP/PhpProjects/myfile.txt", "w"); echo gettype($file) .
Reintech
reintech.io › blog › a-practical-guide-to-php-gettype-function
A Practical Guide to PHP's `gettype()` Function
April 14, 2023 - The gettype() function returns a string representation of a variable's type. Its simple signature makes it accessible for quick type inspection: ... This function returns one of eight possible string values corresponding to PHP's core data types.
Plus2Net
plus2net.com › php_tutorial › gettype.php
gettype() to get type of variable in PHP
<?Php $my_var=true; echo gettype($my_var); // boolean echo "<br>"; echo var_dump($my_var); // bool(true) $my_var=5; echo gettype($my_var); // integer echo "<br>"; echo var_dump($my_var); // int(5) $my_var=5.6; echo gettype($my_var); // double echo "<br>"; echo var_dump($my_var); // flot(5.6) $my_var='plus2net.com'; echo gettype($my_var); // string echo "<br>"; echo var_dump($my_var); // string(12) "plus2net.com" $my_var=Null; echo gettype($my_var); // NULL echo "<br>"; echo var_dump($my_var); // NULL $my_var=array('Mango','Banana','Apple'); echo gettype($my_var); // array echo "<br>"; echo var_dump($my_var); //array(3) { [0]=> string(5)"Mango" [1]=> string(6) "Banana" [2]=> string(5) "Apple" } ?> ←Declaring variables isset()→ empty()→ var_dump()→
W3Schools
w3schools.in › php › gettype-function
gettype() Function in PHP - W3schools
An example of using this gettype() function is as follows: ... <?php echo gettype("W3schools.in").'<br>'; echo gettype('').'<br>'; echo gettype(null).'<br>'; echo gettype(false).'<br>'; echo gettype(array()).'<br>'; echo gettype(new stdclass()).'<br>'; echo gettype(123456).'<br>'; ?>
Chidrestechtutorials
chidrestechtutorials.com › web › php › gettype-function.html
PHP gettype() Function Tutorial
Syntax: gettype(data) : string; where: data : can be a data value, variable name or constant name Let’s prove: $playerScore= 10; // playerScore variable is holding integer type of data $playerSpeed=3.5;// playerSpeed variable is holding double type of data $playerName=”Manjunath”; // ...
YouTube
youtube.com › watch
PHP gettype() Function - PHP Tutorial 21 🚀 - YouTube
PHP gettype() Function - PHP Tutorial 21 🚀► Unlock the power of the PHP gettype() function to identify data types in your scripts. Learn how to use this var...
Published: August 19, 2019
FlatCoding
flatcoding.com › home › php data types: understanding the 10 primitive types
PHP Data Types: Understanding the 10 Primitive Types - FlatCoding
June 29, 2025 - Now, let’s see how to work with this function and get some insight into the types of data within our code in PHP. The gettype function in PHP is a function that is used to return the name of the type of a variable in a string. It returns the data type of the given variable.
OnlinePHP
onlinephp.io › gettype › manual
gettype - OnlinePHP.io Example
gettype( mixed$value ): string · Returns the type of the PHP variable value. For type checking, use is_* functions. value · The variable being type checked.
Code.mu
code.mu › en › php › manual › typing › gettype
The gettype Function - Determining Variable Type in PHP
The gettype function returns a string indicating the type of the passed variable. It accepts one parameter - the variable whose type needs to be determined. ... <?php $var = '123'; echo gettype($var) . "\n"; $var = (int)$var; echo gettype($var) . "\n"; $var = (float)$var; echo gettype($var) .
TechBriefers
techbriefers.com › how-to-check-data-type-in-php-gettype-function-php
PHP gettype() Function: Check data type by PHP get type | TechBriefers
August 8, 2023 - Similarly, we can check other data types using PHP get type function. Further, I will demonstrate checking of Integer, In this case, I have taken the same value as in the String type value. Though, the single quotes are not here, representing the data to be integer values instead of String data type. Let’s check in the example. Taking $value = 1234 which is an integer type (numeric) $value = 1234; echo "1234 Is data type - ".gettype($value);