Integers settype ( $copy, 'int' ) (int) intval() $x + 0 filter_var (…) filter_var (…) ‡1 CastToType::_int ( $x, false, false ) ‡2 abs() empty() is_int() is_numeric() ctype_digit() ‡3 preg_match (`^[0-9]+$`) preg_match (`^[0-9-]+$`) preg_match (`^[\p{N}-]+$`u) Integers
Integers settype ( $copy, 'int' ) (int) intval() $x + 0 filter_var (…) filter_var (…) ‡1 CastToType::_int ( $x, false, false ) ‡2 abs() empty() is_int() is_numeric() ctype_digit() ‡3 preg_match (`^[0-9]+$`) preg_match (`^[0-9-]+$`) preg_match (`^[\p{N}-]+$`u) Integers
$x = null : ( = NULL )
0 0 0 0 b false
null null 0
true false false false false false false $x = null : ( = NULL )
$x = null : ( = NULL )
0 0 0 0 b false
null null 0
true false false false false false false $x = null : ( = NULL )
$x = bool : ( = false )
0 0 0 0 b false
null null 0
true false false false false false false $x = bool : ( = false )
$x = bool : 1 ( = true )
1 1 1 1 1 1 null 1
false false false false true true true $x = bool : 1 ( = true )
$x = int : 1
1 1 1 1 1 1 1 1
false true true false true true true $x = int : 1
$x = int : 0
0 0 0 0 0 0 0 0
true true true false true true true $x = int : 0
$x = int : -1
-1 -1 -1 -1 -1 -1 -1 1
false true true false false true true $x = int : -1
$x = int : 42
42 42 42 42 42 42 42 42
false true true false true true true $x = int : 42
†i8$x = int : 13369593
13369593 13369593 13369593 13369593 13369593 13369593 13369593 13369593
false true true true true true true †i8$x = int : 13369593
†i9$x = int : 42
42 42 42 42 42 42 42 42
false true true false true true true †i9$x = int : 42
†ia$x = int : 57
57 57 57 57 57 57 57 57
false true true true true true true †ia$x = int : 57
†ib$x = string[3] : ‘௫’
0 0 0 0 b false
null null 0
false false false false false false true †ib$x = string[3] : ‘௫’
†ic$x = string[6] : ‘⁸₈’
0 0 0 0 b false
null null 0
false false false false false false true †ic$x = string[6] : ‘⁸₈’
$x = float : 1.3
1 1 1 1.3 b false
null null 1.3 false false true false false false false $x = float : 1.3
$x = float : 0.005
0 0 0 0.005 b false
null null 0.005 false false true false false false false $x = float : 0.005
$x = float : 0
0 0 0 0 0 0 0 0 true false true false true true true $x = float : 0
$x = float : -1.3
-1 -1 -1 -1.3 b false
null null 1.3 false false true false false false false $x = float : -1.3
†f5$x = float : NAN
-9223372036854775808 -9223372036854775808 -9223372036854775808 NAN b false
null null NAN false false true false false false false †f5$x = float : NAN
†f6$x = float : NAN
-9223372036854775808 -9223372036854775808 -9223372036854775808 NAN b false
null null NAN false false true false false false false †f6$x = float : NAN
†f7$x = float : -INF
-9223372036854775808 -9223372036854775808 -9223372036854775808 -INF b false
null null INF false false true false false false false †f7$x = float : -INF
†f8$x = float : INF
-9223372036854775808 -9223372036854775808 -9223372036854775808 INF b false
null null INF false false true false false false false †f8$x = float : INF
†f9$x = float : 123450000
123450000 123450000 123450000 123450000 123450000 123450000 123450000 123450000 false false true false true true true †f9$x = float : 123450000
$x = string[0] : ‘’
0 0 0 0 b false
null null 0
true false false false false false false $x = string[0] : ‘’
$x = string[1] : ‘ ’
0 0 0 0 b false
null null 0
false false false false false false false $x = string[1] : ‘ ’
$x = string[2] : ‘ 1’
1 1 1 1 1 1 1 1
false false true false false false false $x = string[2] : ‘ 1’
$x = string[3] : ‘ 3 ’
3 3 3 3 3 3 3 3
false false false false false false false $x = string[3] : ‘ 3 ’
$x = string[1] : ‘1’
1 1 1 1 1 1 1 1
false false true true true true true $x = string[1] : ‘1’
$x = string[1] : ‘0’
0 0 0 0 0 0 0 0
true false true true true true true $x = string[1] : ‘0’
$x = string[2] : ‘-1’
-1 -1 -1 -1 -1 -1 -1 1
false false true false false true true $x = string[2] : ‘-1’
$x = string[2] : ‘42’
42 42 42 42 42 42 42 42
false false true true true true true $x = string[2] : ‘42’
$x = string[3] : ‘1.3’
1 1 1 1.3 b false
null null 1.3 false false true false false false false $x = string[3] : ‘1.3’
$x = string[3] : ‘0.0’
0 0 0 0 b false
null null 0 false false true false false false false $x = string[3] : ‘0.0’
$x = string[6] : ‘-1.305’
-1 -1 -1 -1.305 b false
null null 1.305 false false true false false false false $x = string[6] : ‘-1.305’
$x = string[4] : ‘true’
0 0 0 0 b false
null null 0
false false false false false false false $x = string[4] : ‘true’
$x = string[5] : ‘false’
0 0 0 0 b false
null null 0
false false false false false false false $x = string[5] : ‘false’
$x = string[4] : ‘null’
0 0 0 0 b false
null null 0
false false false false false false false $x = string[4] : ‘null’
$x = string[6] : ‘123str’
123 123 123 123 b false
null null 123
false false false false false false false $x = string[6] : ‘123str’
$x = string[6] : ‘str123’
0 0 0 0 b false
null null 0
false false false false false false false $x = string[6] : ‘str123’
$x = string[10] : ‘123, "str"’
123 123 123 123 b false
null null 123
false false false false false false false $x = string[10] : ‘123, "str"’
$x = string[8] : ‘0xCC00F9’
0 0 0 13369593 b false
null null 13369593
false false true false false false false $x = string[8] : ‘0xCC00F9’
$x = string[4] : ‘0123’
123 123 123 123 b false
null 123 123
false false true true true true true $x = string[4] : ‘0123’
$x = array()
0 0 0
Fatal error ( #2 )
array()
array()
null b false
true false false false Error
#3 )
Error
#3 )
Error
#3 )
$x = array()
$x = Array: (
    [1 (int)] => string[6] : ‘string’
)
1 1 1
Fatal error ( #2 )
Array: (
  [1] => b false
)
Array: (
  [1] => null
)
Array: (
  [1] => null
)
b false
false false false false Error
#3 )
Error
#3 )
Error
#3 )
$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 )
)
1 1 1
Fatal error ( #2 )
Array: (
  [0] => b false
  [1] => 1
  [2] => b false
  [3] => b false
  [4] => b false
  [5] => b false
)
Array: (
  [0] => null
  [1] => 1
  [2] => null
  [3] => null
  [4] => null
  [5] => null
)
Array: (
  [0] => null
  [1] => 1
  [2] => null
  [3] => null
  [4] => null
  [5] => null
)
b false
false false false false Error
#3 )
Error
#3 )
Error
#3 )
$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 (
    )
)
1
#4 )
1
#4 )
1
#4 )
1
#4 )
b false
null null 1

#4 )
false false false false Error
#3 )
Error
#3 )
Error
#3 )
$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
    )
)
1
#4 )
1
#4 )
1
#4 )
1
#4 )
b false
null null 1

#4 )
false false false false false false false $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 )
10 10 10 10 b false
null null 10
false false false false Error
#3 )
Error
#3 )
Error
#3 )
$x = resource : Resource id #10 ( = RESOURCE )
$x = Object: (
    Class: SplBool (
        property: __default = bool : ( = false )
        method: getConstList
        method: __construct
    )
)
0 0 0 Fatal error #5 b false
null null 0
true false false false false false false $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
    )
)
1 1 1 Fatal error #5 b false
null null 1
false false false false true true true $x = Object: (
    Class: SplBool (
        property: __default = bool : 1 ( = true )
        method: getConstList
        method: __construct
    )
)