String tests is_string() empty() == '' === '' ctype_alpha() ‡1 preg_match (`^[A-Za-z]+$`) preg_match (`^\p{L}+$`u) ctype_alnum() ‡1 preg_match (`^[A-Za-z0-9]+$`) preg_match (`^\w+$`) preg_match (`^\w+$`u) ‡2 preg_match (`^[\p{L}\p{N}]+$`u) strlen() count_chars (…) mb_strlen() $x{2} trim() String tests
String tests is_string() empty() == '' === '' ctype_alpha() ‡1 preg_match (`^[A-Za-z]+$`) preg_match (`^\p{L}+$`u) ctype_alnum() ‡1 preg_match (`^[A-Za-z0-9]+$`) preg_match (`^\w+$`) preg_match (`^\w+$`u) ‡2 preg_match (`^[\p{L}\p{N}]+$`u) strlen() count_chars (…) mb_strlen() $x{2} trim() String tests
$x = null : ( = NULL )
false true true false false false false false false false false false 0 0
0 null ‘’
$x = null : ( = NULL )
$x = null : ( = NULL )
false true true false false false false false false false false false 0 0
0 null ‘’
$x = null : ( = NULL )
$x = bool : ( = false )
false true true false false false false false false false false false 0 0
0 null ‘’
$x = bool : ( = false )
$x = bool : 1 ( = true )
false false false false false false false false true true true true 1 1
1 null ‘1’
$x = bool : 1 ( = true )
$x = int : 1
false false false false false false false false true true true true 1 1
1 null ‘1’
$x = int : 1
$x = int : 0
false true true false false false false false true true true true 1 1
1 null ‘0’
$x = int : 0
$x = int : -1
false false false false false false false false false false false false 2 2
2 null ‘-1’
$x = int : -1
$x = int : 42
false false false false false false false false true true true true 2 2
2 null ‘42’
$x = int : 42
†i8$x = int : 13369593
false false false false false false false true true true true true 8 8
8 null ‘13369593’
†i8$x = int : 13369593
†i9$x = int : 42
false false false false false false false false true true true true 2 2
2 null ‘42’
†i9$x = int : 42
†ia$x = int : 57
false false false false false false false true true true true true 2 2
2 null ‘57’
†ia$x = int : 57
$x = float : 1.3
false false false false false false false false false false false false 3 3
3 null ‘1.3’
$x = float : 1.3
$x = float : 0.005
false false false false false false false false false false false false 5 5
5 null ‘0.005’
$x = float : 0.005
$x = float : 0
false true true false false false false false true true true true 1 1
1 null ‘0’
$x = float : 0
$x = float : -1.3
false false false false false false false false false false false false 4 4
4 null ‘-1.3’
$x = float : -1.3
†f5$x = float : NAN
false false false false false true true false true true true true 3 3
3 null ‘NAN’
†f5$x = float : NAN
†f6$x = float : NAN
false false false false false true true false true true true true 3 3
3 null ‘NAN’
†f6$x = float : NAN
†f7$x = float : -INF
false false false false false false false false false false false false 4 4
4 null ‘-INF’
†f7$x = float : -INF
†f8$x = float : INF
false false false false false true true false true true true true 3 3
3 null ‘INF’
†f8$x = float : INF
†f9$x = float : 123450000
false false false false false false false false true true true true 9 9
9 null ‘123450000’
†f9$x = float : 123450000
$x = string[0] : ‘’
true true true true false false false false false false false false 0 0
0 ‘’

#2 )
‘’
$x = string[0] : ‘’
$x = string[1] : ‘ ’
true false false false false false false false false false false false 1 1
1 ‘’

#2 )
‘’
$x = string[1] : ‘ ’
$x = string[2] : ‘ 1’
true false false false false false false false false false false false 2 2
2 ‘’

#2 )
‘1’
$x = string[2] : ‘ 1’
$x = string[3] : ‘ 3 ’
true false false false false false false false false false false false 3 3
3 ‘ ’
‘3’
$x = string[3] : ‘ 3 ’
$x = string[1] : ‘1’
true false false false false false false true true true true true 1 1
1 ‘’

#2 )
‘1’
$x = string[1] : ‘1’
$x = string[1] : ‘0’
true true false false false false false true true true true true 1 1
1 ‘’

#2 )
‘0’
$x = string[1] : ‘0’
$x = string[2] : ‘-1’
true false false false false false false false false false false false 2 2
2 ‘’

#2 )
‘-1’
$x = string[2] : ‘-1’
$x = string[2] : ‘42’
true false false false false false false true true true true true 2 2
2 ‘’

#2 )
‘42’
$x = string[2] : ‘42’
$x = string[3] : ‘1.3’
true false false false false false false false false false false false 3 3
3 ‘3’
‘1.3’
$x = string[3] : ‘1.3’
$x = string[3] : ‘0.0’
true false false false false false false false false false false false 3 3
3 ‘0’
‘0.0’
$x = string[3] : ‘0.0’
$x = string[6] : ‘-1.305’
true false false false false false false false false false false false 6 6
6 ‘.’
‘-1.305’
$x = string[6] : ‘-1.305’
$x = string[4] : ‘true’
true false false false true true true true true true true true 4 4
4 ‘u’
‘true’
$x = string[4] : ‘true’
$x = string[5] : ‘false’
true false false false true true true true true true true true 5 5
5 ‘l’
‘false’
$x = string[5] : ‘false’
$x = string[4] : ‘null’
true false false false true true true true true true true true 4 4
4 ‘l’
‘null’
$x = string[4] : ‘null’
$x = string[6] : ‘123str’
true false false false false false false true true true true true 6 6
6 ‘3’
‘123str’
$x = string[6] : ‘123str’
$x = string[6] : ‘str123’
true false false false false false false true true true true true 6 6
6 ‘r’
‘str123’
$x = string[6] : ‘str123’
$x = string[10] : ‘123, "str"’
true false false false false false false false false false false false 10 10
10 ‘3’
‘123, "str"’
$x = string[10] : ‘123, "str"’
$x = string[8] : ‘0xCC00F9’
true false false false false false false true true true true true 8 8
8 ‘C’
‘0xCC00F9’
$x = string[8] : ‘0xCC00F9’
$x = string[4] : ‘0123’
true false false false false false false true true true true true 4 4
4 ‘2’
‘0123’
$x = string[4] : ‘0123’
$x = string[27] : ‘Iñtërnâtiônàlizætiøn’
true false false false false false true false false false true true 27 27
20 ‘’
‘Iñtërnâtiônàlizætiøn’
$x = string[27] : ‘Iñtërnâtiônàlizætiøn’
$x = array()
false true false false false Error
#3 )
Error
#3 )
false Error
#3 )
Error
#3 )
Error
#3 )
Error
#3 )
null
#4 )
null
#5 )
#6 )
false
#7 )
null
#8 )
null
#9 )
$x = array()
$x = Array: (
    [1 (int)] => string[6] : ‘string’
)
false false false false false Error
#3 )
Error
#3 )
false Error
#3 )
Error
#3 )
Error
#3 )
Error
#3 )
null
#4 )
null
#5 )
#6 )
false
#7 )
null
#8 )
null
#9 )
$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 false false false Error
#3 )
Error
#3 )
false Error
#3 )
Error
#3 )
Error
#3 )
Error
#3 )
null
#4 )
null
#5 )
#6 )
false
#7 )
1.3
null
#9 )
$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 false false false Error
#3 )
Error
#3 )
false Error
#3 )
Error
#3 )
Error
#3 )
Error
#3 )
null
#4 )
null
#5 )
#6 )
false
#7 )

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