PHP Data types and PHP data types PHP has several data types what PHP data types have

Source: Internet
Author: User
Tags scalar what php
Data type

Integral type
Floating point Type
Boolean type
String
Array
Object

Conversion between types

(int) $val; Convert to integral type
(float) $val; Convert to floating point type
(string) $val; Convert to String
(bool) $val; Convert to Boolean type
(array) $val; Converts an array that contains only one element of $val. [$val]
(object) $val; Convert to an object, the scalar property of the object points to $val. {scalar: $val}

Get type

Use the function string GetType ($val); Get the variable type
The function returns a value of array, Boolean, double, Integer, Object, Resource, String, NULL, and unknown type.
Alternatively, you can use the following function to determine the variable type
Is_array (Val); Is_bool (Val); Is_float (Val); Is_integer (Val); Is_null (Val); Is_numeric (Val); Is_object (Val); Is_resource (Val); Is_scalar (Val); and Is_string (Val);

PHP Super Global variables

$_server contains data about the browser and the server
$_get contains the GET data from the URL request
$_post contains the POST data from the URL request
$_cookie contains COOKIE data for the browser
$_session for accessing SESSION data
$_files contains the data uploaded by the file
$GLOBALS contains all the global variables

The above describes the PHP data type and conversion, including the data type, PHP content, I hope the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.