Php Data type conversion _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags php mysql
Php Data type conversion. This article mainly shares the knowledge of PHP Data type conversion. PHP Data type conversion is a forced conversion. The PHP Data types that can be converted include: (int) and (integer). This article mainly shares the knowledge of PHP Data type conversion.

PHP Data type conversion is a forced conversion. The PHP Data types that can be converted include:

(Int), (integer): convert to integer
(Float), (double), (real): convert to floating point type
(String): convert to a string
(Bool), (boolean): convert to boolean type
(Array): convert to an array
(Object): convert to object

There are three conversion methods for PHP Data types:

(1) add the target type enclosed in parentheses before the variable to be converted, for example:

(Int) (bool) (float) (string) (array) (object) is described in the following example:

 

(2) use three types of conversion functions: intval (), floatval (), and strval (). The example is as follows:

  

(3) use the common type conversion function settype (mixed var, string type). The example is as follows:

   Articles you may be interested in
   
   
  • In php, we use the curl post method to submit data and the get method to obtain webpage data.
  • How does php convert the br line breaks in html to line breaks in text input?
  • Php converts a multi-dimensional array to a one-dimensional array
  • Methods for resetting the auto-increment start value of various MySQL data table types
  • Php mysql database operations
  • Powerful PHP image processing class (Watermark, transparency, zoom, sharpen, rotate, flip, cut, reversed)
  • Php uses array_flip to implement array key-value exchange to remove array duplicate values
  • Introduction to array union, intersection, and difference set functions in php

Bytes. PHP Data type conversion is a forced conversion. The PHP Data types that can be converted include: (int) and (integer): converted...

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.