Array testing is_array() count() empty() count() > 0 isset ( $x[0] ) ‡1 array_key_exists ( 0, $x ) ‡1 isset ( $x['foo'] ) ‡1 key() current() $x['foo'] $x['foo']['bar'] array_filter() Array testing
Array testing is_array() count() empty() count() > 0 isset ( $x[0] ) ‡1 array_key_exists ( 0, $x ) ‡1 isset ( $x['foo'] ) ‡1 key() current() $x['foo'] $x['foo']['bar'] array_filter() Array testing
$x = null : ( = NULL )
false 0 true false false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = null : ( = NULL )
$x = null : ( = NULL )
false 0 true false false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = null : ( = NULL )
$x = bool : ( = false )
false 1 true true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = bool : ( = false )
$x = bool : 1 ( = true )
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = bool : 1 ( = true )
$x = int : 1
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = int : 1
$x = int : 0
false 1 true true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = int : 0
$x = int : -1
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = int : -1
$x = int : 42
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = int : 42
†i8$x = int : 13369593
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†i8$x = int : 13369593
†i9$x = int : 42
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†i9$x = int : 42
†ia$x = int : 57
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†ia$x = int : 57
$x = float : 1.3
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = float : 1.3
$x = float : 0.005
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = float : 0.005
$x = float : 0
false 1 true true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = float : 0
$x = float : -1.3
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
$x = float : -1.3
†f5$x = float : NAN
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†f5$x = float : NAN
†f6$x = float : NAN
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†f6$x = float : NAN
†f7$x = float : -INF
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†f7$x = float : -INF
†f8$x = float : INF
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†f8$x = float : INF
†f9$x = float : 123450000
false 1 false true false null
#2 )
false null
#3 )
null
#4 )
null null null
#5 )
†f9$x = float : 123450000
$x = string[0] : ‘’
false 1 true true false null
#2 )
false null
#3 )
null
#4 )
‘’

#6 )
#7 )
‘’

#6 )
#7 )
#8 )
#7 )
null
#5 )
$x = string[0] : ‘’
$x = string[1] : ‘ ’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘ ’

#6 )
‘ ’

#6 )
#8 )
null
#5 )
$x = string[1] : ‘ ’
$x = string[2] : ‘ 1’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘ ’

#6 )
‘ ’

#6 )
#8 )
null
#5 )
$x = string[2] : ‘ 1’
$x = string[3] : ‘ 3 ’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘ ’

#6 )
‘ ’

#6 )
#8 )
null
#5 )
$x = string[3] : ‘ 3 ’
$x = string[1] : ‘1’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘1’

#6 )
‘1’

#6 )
#8 )
null
#5 )
$x = string[1] : ‘1’
$x = string[1] : ‘0’
false 1 true true true null
#2 )
false null
#3 )
null
#4 )
‘0’

#6 )
‘0’

#6 )
#8 )
null
#5 )
$x = string[1] : ‘0’
$x = string[2] : ‘-1’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘-’

#6 )
‘-’

#6 )
#8 )
null
#5 )
$x = string[2] : ‘-1’
$x = string[2] : ‘42’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘4’

#6 )
‘4’

#6 )
#8 )
null
#5 )
$x = string[2] : ‘42’
$x = string[3] : ‘1.3’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘1’

#6 )
‘1’

#6 )
#8 )
null
#5 )
$x = string[3] : ‘1.3’
$x = string[3] : ‘0.0’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘0’

#6 )
‘0’

#6 )
#8 )
null
#5 )
$x = string[3] : ‘0.0’
$x = string[6] : ‘-1.305’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘-’

#6 )
‘-’

#6 )
#8 )
null
#5 )
$x = string[6] : ‘-1.305’
$x = string[4] : ‘true’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘t’

#6 )
‘t’

#6 )
#8 )
null
#5 )
$x = string[4] : ‘true’
$x = string[5] : ‘false’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘f’

#6 )
‘f’

#6 )
#8 )
null
#5 )
$x = string[5] : ‘false’
$x = string[4] : ‘null’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘n’

#6 )
‘n’

#6 )
#8 )
null
#5 )
$x = string[4] : ‘null’
$x = string[6] : ‘123str’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘1’

#6 )
‘1’

#6 )
#8 )
null
#5 )
$x = string[6] : ‘123str’
$x = string[6] : ‘str123’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘s’

#6 )
‘s’

#6 )
#8 )
null
#5 )
$x = string[6] : ‘str123’
$x = string[10] : ‘123, "str"’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘1’

#6 )
‘1’

#6 )
#8 )
null
#5 )
$x = string[10] : ‘123, "str"’
$x = string[8] : ‘0xCC00F9’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘0’

#6 )
‘0’

#6 )
#8 )
null
#5 )
$x = string[8] : ‘0xCC00F9’
$x = string[4] : ‘0123’
false 1 false true true null
#2 )
false null
#3 )
null
#4 )
‘0’

#6 )
‘0’

#6 )
#8 )
null
#5 )
$x = string[4] : ‘0123’
$x = array()
true 0 true false false false false null b false
null
#9 )
null
#9 )
array()
$x = array()
$x = Array: (
    [1 (int)] => string[6] : ‘string’
)
true 1 false true false false false 1
‘string’
null
#9 )
null
#9 )
Array: (
  [1] => ‘string’
)
$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 )
)
true 6 false true true true false 0
b false
null
#9 )
null
#9 )
Array: (
  [1] => 1
  [2] => 1.3
  [3] => ‘123str’
  [4] => ‘str123’
)
$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 1 false true
Fatal error ( #10 )
false
Fatal error ( #10 )
null b false

Fatal error ( #10 )

Fatal error ( #10 )
null
#5 )
$x = Object: (
    Class: stdClass (
    )
)
$x = Object: (
    Class: TestObject (
        property: test1 = null : ( = NULL )
        property: test2 = bool : 1 ( = true )
        method: print_it
    )
)
false 1 false true
Fatal error ( #10 )
false
Fatal error ( #10 )
‘test1’
null
Fatal error ( #10 )

Fatal error ( #10 )
null
#5 )
$x = Object: (
    Class: TestObject (
        property: test1 = null : ( = NULL )
        property: test2 = bool : 1 ( = true )
        method: print_it
    )
)
$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 1 false true
Fatal error ( #10 )
false
Fatal error ( #10 )
‘test3’
‘some string’

Fatal error ( #10 )

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

Fatal error ( #10 )

Fatal error ( #10 )
null
#5 )
$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 1 false true
Fatal error ( #10 )
false
Fatal error ( #10 )
‘__default’
b true

Fatal error ( #10 )

Fatal error ( #10 )
null
#5 )
$x = Object: (
    Class: SplBool (
        property: __default = bool : 1 ( = true )
        method: getConstList
        method: __construct
    )
)