Home  >  Article  >  Backend Development  >  How to represent integers in php

How to represent integers in php

(*-*)浩
(*-*)浩Original
2019-09-07 11:08:374603browse

How to represent integers in php

PHP Integers

Integers are numbers without decimals.

Integer rules:

The integer must have at least one digit (0-9)

The integer cannot contain commas or spaces

Integers cannot have decimal points

Integers can be positive or negative (recommended learning:PHP programming from entry to proficiency)

Integers can be specified in three formats: decimal , hexadecimal (prefix is ​​0x) or octal (prefix is ​​0)

In the following example, we will test different numbers. PHP var_dump() will return the data type and value of the variable:

Example





"; 
$x = -345; // 负数 
var_dump($x);
echo "
"; $x = 0x8C; // 十六进制数 var_dump($x); echo "
"; $x = 047; // 八进制数 var_dump($x); ?>

The above is the detailed content of How to represent integers in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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