PHP supports 8 primitive data types.
Four scalar types:
boolean (Boolean)
integer (integer)
float (floating point, also called double)
string (string)
two Specific composite type: aArray For readability, this manual also introduces some pseudo-types:
mixed (mixed type)
number (numeric type)
callback (callback type)
and pseudo-variables $….
You may also read some references to the "double" type. In fact, double and float are the same. For some historical reasons, these two names exist at the same time.
The type of a variable is usually not set by the programmer. Rather, it is determined by PHP at runtime based on the context in which the variable is used.
Note: If you want to check the value and type of an expression, use the var_dump() function. If you just want to get an easy-to-understand type expression for debugging, use the gettype() function. To check a type, don't use gettype(), use the is_type function. Here are some examples:
<?php $a_bool = TRUE; // a boolean $a_str = "foo"; // a string $a_str2 = 'foo'; // a string $an_int = 12; // an integer echo gettype($a_bool); // prints out: boolean echo gettype($a_str); // prints out: string // If this is an integer, increment it by four if (is_int($an_int)) { $an_int += 4; } // If $bool is a string, print it out // (does not print out anything) if (is_string($a_bool)) { echo "String: $a_bool"; } ?>
Note that variables will exhibit different values on specific occasions depending on their type at the time. See Type Conversion Discrimination for more information. In addition, you can also refer to the PHP type comparison table for examples of how different types compare to each other.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use