Numeric tests is_numeric() ctype_digit() ‡1 preg_match (`^[\p{N}-]+$`u) preg_match (`^[\p{N}\.-]+$`u) > 0 >= 0 == 0 === 0 != 0 !== 0 < 0 <= 0 is_nan() is_finite() is_infinite() floor() ceil() round() Numeric tests
Numeric tests is_numeric() ctype_digit() ‡1 preg_match (`^[\p{N}-]+$`u) preg_match (`^[\p{N}\.-]+$`u) > 0 >= 0 == 0 === 0 != 0 !== 0 < 0 <= 0 is_nan() is_finite() is_infinite() floor() ceil() round() Numeric tests
$x = null : ( = NULL )
false false false false false true true false false true false true false true false 0 0 0 $x = null : ( = NULL )
$x = null : ( = NULL )
false false false false false true true false false true false true false true false 0 0 0 $x = null : ( = NULL )
$x = bool : ( = false )
false false false false false true true false false true false true false true false 0 0 0 $x = bool : ( = false )
$x = bool : 1 ( = true )
false false true true true true false false true true false false false true false 1 1 1 $x = bool : 1 ( = true )
$x = int : 1
true false true true true true false false true true false false false true false 1 1 1 $x = int : 1
$x = int : 0
true false true true false true true true false false false true false true false 0 0 0 $x = int : 0
$x = int : -1
true false true true false false false false true true true true false true false -1 -1 -1 $x = int : -1
$x = int : 42
true false true true true true false false true true false false false true false 42 42 42 $x = int : 42
†i8$x = int : 13369593
true true true true true true false false true true false false false true false 13369593 13369593 13369593 †i8$x = int : 13369593
†i9$x = int : 42
true false true true true true false false true true false false false true false 42 42 42 †i9$x = int : 42
†ia$x = int : 57
true true true true true true false false true true false false false true false 57 57 57 †ia$x = int : 57
†ib$x = string[3] : ‘௫’
false false true true false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 †ib$x = string[3] : ‘௫’
†ic$x = string[6] : ‘⁸₈’
false false true true false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 †ic$x = string[6] : ‘⁸₈’
$x = float : 1.3
true false false true true true false false true true false false false true false 1 2 1 $x = float : 1.3
$x = float : 0.005
true false false true true true false false true true false false false true false 0 1 0 $x = float : 0.005
$x = float : 0
true false true true false true true false false true false true false true false 0 0 0 $x = float : 0
$x = float : -1.3
true false false true false false false false true true true true false true false -2 -1 -1 $x = float : -1.3
†f5$x = float : NAN
true false false false false false false false true true false false true false false NAN NAN NAN †f5$x = float : NAN
†f6$x = float : NAN
true false false false false false false false true true false false true false false NAN NAN NAN †f6$x = float : NAN
†f7$x = float : -INF
true false false false false false false false true true true true false false true -INF -INF -INF †f7$x = float : -INF
†f8$x = float : INF
true false false false true true false false true true false false false false true INF INF INF †f8$x = float : INF
†f9$x = float : 123450000
true false true true true true false false true true false false false true false 123450000 123450000 123450000 †f9$x = float : 123450000
†fa$x = string[3] : ‘⅕’
false false true true false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 †fa$x = string[3] : ‘⅕’
$x = string[0] : ‘’
false false false false false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 $x = string[0] : ‘’
$x = string[1] : ‘ ’
false false false false false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 $x = string[1] : ‘ ’
$x = string[2] : ‘ 1’
true false false false true true false false true true false false false true false 1 1 1 $x = string[2] : ‘ 1’
$x = string[3] : ‘ 3 ’
false false false false true true false false true true false false false
#5 )
true
#5 )
false
#5 )
3 3 3 $x = string[3] : ‘ 3 ’
$x = string[1] : ‘1’
true true true true true true false false true true false false false true false 1 1 1 $x = string[1] : ‘1’
$x = string[1] : ‘0’
true true true true false true true false false true false true false true false 0 0 0 $x = string[1] : ‘0’
$x = string[2] : ‘-1’
true false true true false false false false true true true true false true false -1 -1 -1 $x = string[2] : ‘-1’
$x = string[2] : ‘42’
true true true true true true false false true true false false false true false 42 42 42 $x = string[2] : ‘42’
$x = string[3] : ‘1.3’
true false false true true true false false true true false false false true false 1 2 1 $x = string[3] : ‘1.3’
$x = string[3] : ‘0.0’
true false false true false true true false false true false true false true false 0 0 0 $x = string[3] : ‘0.0’
$x = string[6] : ‘-1.305’
true false false true false false false false true true true true false true false -2 -1 -1 $x = string[6] : ‘-1.305’
$x = string[4] : ‘true’
false false false false false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 $x = string[4] : ‘true’
$x = string[5] : ‘false’
false false false false false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 $x = string[5] : ‘false’
$x = string[4] : ‘null’
false false false false false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 $x = string[4] : ‘null’
$x = string[6] : ‘123str’
false false false false true true false false true true false false false
#5 )
true
#5 )
false
#5 )
123 123 123 $x = string[6] : ‘123str’
$x = string[6] : ‘str123’
false false false false false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 $x = string[6] : ‘str123’
$x = string[10] : ‘123, "str"’
false false false false true true false false true true false false false
#5 )
true
#5 )
false
#5 )
123 123 123 $x = string[10] : ‘123, "str"’
$x = string[8] : ‘0xCC00F9’
true false false false true true false false true true false false false true false 13369593 13369593 13369593 $x = string[8] : ‘0xCC00F9’
$x = string[4] : ‘0123’
true true true true true true false false true true false false false true false 123 123 123 $x = string[4] : ‘0123’
$x = array()
false false Error
#6 )
Error
#6 )
true true false false true true false false null
#2 )
null
#3 )
null
#4 )
b false
b false
b false
$x = array()
$x = Array: (
    [1 (int)] => string[6] : ‘string’
)
false false Error
#6 )
Error
#6 )
true true false false true true false false null
#2 )
null
#3 )
null
#4 )
b false
b false
b false
$x = Array: (
    [1 (int)] => string[6] : ‘string’
)
$x = Array: (
    [0 (int)] => bool : ( = false )
    [1 (int)] => int : 1
    [2 (int)] => float : 1.3
    [3 (int)] => string[6] : ‘123str’
    [4 (int)] => string[6] : ‘str123’
    [5 (int)] => null : ( = NULL )
)
false false Error
#6 )
Error
#6 )
true true false false true true false false null
#2 )
null
#3 )
null
#4 )
b false
b false
b false
$x = Array: (
    [0 (int)] => bool : ( = false )
    [1 (int)] => int : 1
    [2 (int)] => float : 1.3
    [3 (int)] => string[6] : ‘123str’
    [4 (int)] => string[6] : ‘str123’
    [5 (int)] => null : ( = NULL )
)
$x = Object: (
    Class: stdClass (
    )
)
false false Error
#6 )
Error
#6 )
true
#7 )
true
#7 )
false
#7 )
false true
#7 )
true false
#7 )
false
#7 )
null
#2 )
null
#3 )
null
#4 )
1
#7 )
1
#7 )
1
#7 )
$x = Object: (
    Class: stdClass (
    )
)
$x = Object: (
    Class: TestObjectToString (
        property: test3 = string[11] : ‘some string’
        property: test1 = null : ( = NULL )
        property: test2 = bool : 1 ( = true )
        method: __toString
        method: print_it
    )
)
false false false false true
#7 )
true
#7 )
false
#7 )
false true
#7 )
true false
#7 )
false
#7 )
null
#2 )
null
#3 )
null
#4 )
1
#7 )
1
#7 )
1
#7 )
$x = Object: (
    Class: TestObjectToString (
        property: test3 = string[11] : ‘some string’
        property: test1 = null : ( = NULL )
        property: test2 = bool : 1 ( = true )
        method: __toString
        method: print_it
    )
)
$x = resource : Resource id #10 ( = RESOURCE )
false false Error
#6 )
Error
#6 )
true true false false true true false false null
#2 )
null
#3 )
null
#4 )
10 10 10 $x = resource : Resource id #10 ( = RESOURCE )
$x = Object: (
    Class: SplBool (
        property: __default = bool : ( = false )
        method: getConstList
        method: __construct
    )
)
false false false false false true true false false true false true null
#2 )
null
#3 )
null
#4 )
0 0 0 $x = Object: (
    Class: SplBool (
        property: __default = bool : ( = false )
        method: getConstList
        method: __construct
    )
)
$x = Object: (
    Class: SplBool (
        property: __default = bool : 1 ( = true )
        method: getConstList
        method: __construct
    )
)
false false true true true true false false true true false false null
#2 )
null
#3 )
null
#4 )
1 1 1 $x = Object: (
    Class: SplBool (
        property: __default = bool : 1 ( = true )
        method: getConstList
        method: __construct
    )
)