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.
Altorouter
altorouter.com › home › master php’s gettype function: a detailed guide
Understanding PHP Get Type: Mastering the Function
January 22, 2024 - The syntax for employing the `gettype()` function is straightforward: ... In PHP, a language known for its flexibility, the understanding of variable types is crucial for effective coding practices. The `gettype()` function serves as a bridge to this understanding, offering a way to identify the specific type of a given variable.
W3schools
w3schools.dev › php › func_var_gettype.asp
PHP gettype() Function - W3Schools
<?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) .