Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
PHP
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Data types === PHP is [[strong and weak typing|loosely typed]]. It stores integers in a platform-dependent range, either as a 32, 64 or 128-bit [[signed number representations|signed]] [[integer (computer science)|integer]] equivalent to the [[C variable types and declarations|C-language long type]]. Unsigned integers are converted to signed values in certain situations, which is different behaviour to many other programming languages.<ref>{{cite web | url = http://www.mysqlperformanceblog.com/2007/03/27/integers-in-php-running-with-scissors-and-portability/ | title = Integers in PHP, running with scissors, and portability | date = March 27, 2007 | publisher = MySQL Performance Blog | access-date = 2007-03-28}}</ref> Integer variables can be assigned using decimal (positive and negative), [[octal]], [[hexadecimal]], and [[binary number|binary]] notations.<ref>{{cite web|access-date=2025-05-26|url=https://www.php.net/manual/en/language.types.integer.php|title=Integers|website=PHP Manual |publisher=The PHP Group}}</ref> [[Floating-point number]]s are also stored in a platform-specific range. They can be specified using floating-point notation, or two forms of [[scientific notation]].<ref name="The PHP Group-2">{{cite web|access-date=2008-03-16|url=https://www.php.net/manual/en/language.types.php|title=Types |publisher=The PHP Group}}</ref> PHP has a native [[Boolean data type|Boolean]] type that is similar to the native Boolean types in [[Java (programming language)|Java]] and [[C++]]. Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in [[Perl]] and C++.<ref name="The PHP Group-2" /> The null data type represents a variable that has no value; <code>NULL</code> is the only allowed value for this data type.<ref name="The PHP Group-2" /> Variables of the "resource" type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources.<ref name="The PHP Group-2" /> Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in [[hash table|hashes]] with both keys and values, and the two can be intermingled.<ref name="The PHP Group-2" /> PHP also supports [[string (computing)|strings]], which can be used with single quotes, double quotes, nowdoc or [[heredoc]] syntax.<ref>{{cite web|access-date=2008-03-21|url=https://www.php.net/manual/en/language.types.string.php|title=Strings |publisher=The PHP Group}}</ref> The '''Standard PHP Library''' (SPL) attempts to solve standard problems and implements efficient data access interfaces and classes.<ref>{{cite web | url = https://www.php.net/spl | title = SPL β StandardPHPLibrary | date = March 16, 2009 | website = PHP.net | access-date = 2009-03-16}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)