PHP Data type Conversion _php Tutorial

Source: Internet
Author: User
Tags how to use curl php mysql
This article mainly shares the knowledge of PHP data type conversion.

PHP's data type conversions are cast, and the PHP data types that are allowed to be converted are:

(int), (integer): Convert to Reshape
(float), (double), (real): Convert to floating-point type
(string): converted to a string
(bool), (Boolean): Converted to Boolean type
(array): Convert an array
(object): Convert to Object

There are three ways to convert PHP data types:

(1) Precede the variable to be converted with a target type enclosed in parentheses, for example:

(int)  (BOOL)  (float)  (string) (array) (object) is illustrated below with an example:

 

(2) using 3 specific types of conversion functions, intval (), Floatval (), Strval (), the example is as follows:

  

(3) using the generic type conversion function Settype (mixed var,string type), the following example:

   

Articles you may be interested in

    • How to use Curl's post submission data in PHP and get a summary of how to get Web page data
    • How PHP converts BR newline characters in HTML to line breaks in text input
    • How PHP converts multidimensional arrays to one-dimensional arrays
    • MySQL various data table types reset the self-increment start value method
    • PHP MySQL database operation class
    • Powerful PHP Image processing class (watermark, transparency, zoom, sharpen, rotate, flip, cut, invert)
    • PHP uses Array_flip to implement array key-value Exchange to remove array duplicate values
    • Introduction to the set, intersection, and difference functions of arrays in PHP

http://www.bkjia.com/PHPjc/764075.html www.bkjia.com true http://www.bkjia.com/PHPjc/764075.html techarticle This article mainly shares the knowledge of PHP data type conversion. PHP's data type conversions are cast, and the PHP data types that are allowed to be converted are: (int), (integer): Converted to ...

  • 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.