Code:
Results:
The second conversion method: conversion function, intval (), floatval (), strval ();
Code:
Results:
The third conversion method: universal type conversion function settype (mixed var, string type);
Code:
Results:
Extended data:
PHP data type conversion is mandatory, and the allowed PHP data types are:
(int), (integer): converted into plastic;
(float), (double), (real): converted to floating-point type;
(String): Convert to a string;
(bool), (boolean): Convert to Boolean type;
(Array): Convert to an array;
(Object): Convert to an object.
References:
PHP Chinese website-analysis of type conversion