Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP Type Comparison

PHP Type Comparison

Although PHP is a loosely typed language, you still need to understand variable types and their meanings, because we often need to compare PHP variables, including loose and strict comparison.

For example, "42" is a string while 42 is an integer. FALSE is a boolean while "FALSE" is a string.

Example

The output of the above example is:

1、值相等

3、类型不相等

Comparing 0, false, null in PHP

Test code:

Example