Home > Backend Development > PHP Tutorial > PHP data types and judgment variable types

PHP data types and judgment variable types

巴扎黑
Release: 2016-11-07 17:15:19
Original
1268 people have browsed it

PHP data types include: string, integer, floating point number, Boolean, array, object, NULL.

How to determine the variable type, use the var_dump function.
The var_dump function is to determine the type and length of a variable and output the value of the variable. If the variable has a value, it will lose the value of the variable and return the data type.

Java code

$val1 = 1;

$val2 = 3.14;

$val3 = 'Who reads it and asks you to recite it, the water falls and the fragrance floats. ';

$val4 = array('aaa','bbb');

$val5 = true;

$val6 = function(){};

$val7 = null;

var_dump($val1) ;//Integer

echo '
';

var_dump($val2);//Floating point number

echo '
';

var_dump($val3);//String

echo '
';

var_dump($val4);//Array

echo '
';

var_dump($val5);//Boolean

echo '
';

var_dump($val6);//Object

echo '
';

var_dump($val7);//NULL

?>

Rendering:

PHP data types and judgment variable types

PS: Since the encoding used is UTF-8, each Chinese character takes up 3 bytes, while English Each character occupies 1 byte.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template