1--TEST--
2Inc/dec various strings
3--FILE--
4<?php
5
6echo "Using increment:\n";
7$values = [
8    '',
9    ' ',
10    // Numeric-ish values
11    '0',
12    '15.5',
13    '1e10',
14    // Alphanumeric values
15    '199A',
16    'A199',
17    '199Z',
18    'Z199',
19    // Strings
20    'Hello world',
21    '��'
22];
23foreach ($values as $value) {
24    echo "Initial value:";
25    var_dump($value);
26    $value++;
27    echo "Result value:";
28    var_dump($value);
29}
30
31echo "Using decrement:\n";
32$values = [
33    '',
34    ' ',
35    // Numeric-ish values
36    '0',
37    '15.5',
38    '1e10',
39    // Alphanumeric values
40    '199A',
41    'A199',
42    '199Z',
43    'Z199',
44    // Strings
45    'Hello world',
46    '��'
47];
48foreach ($values as $value) {
49    echo "Initial value:";
50    var_dump($value);
51    $value--;
52    echo "Result value:";
53    var_dump($value);
54}
55?>
56--EXPECTF--
57Using increment:
58Initial value:string(0) ""
59
60Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
61Result value:string(1) "1"
62Initial value:string(1) " "
63
64Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
65Result value:string(1) " "
66Initial value:string(1) "0"
67Result value:int(1)
68Initial value:string(4) "15.5"
69Result value:float(16.5)
70Initial value:string(4) "1e10"
71Result value:float(10000000001)
72Initial value:string(4) "199A"
73Result value:string(4) "199B"
74Initial value:string(4) "A199"
75Result value:string(4) "A200"
76Initial value:string(4) "199Z"
77Result value:string(4) "200A"
78Initial value:string(4) "Z199"
79Result value:string(4) "Z200"
80Initial value:string(11) "Hello world"
81
82Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
83Result value:string(11) "Hello worle"
84Initial value:string(4) "��"
85
86Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
87Result value:string(4) "��"
88Using decrement:
89Initial value:string(0) ""
90
91Deprecated: Decrement on empty string is deprecated as non-numeric in %s on line %d
92Result value:int(-1)
93Initial value:string(1) " "
94
95Deprecated: Decrement on non-numeric string has no effect and is deprecated in %s on line %d
96Result value:string(1) " "
97Initial value:string(1) "0"
98Result value:int(-1)
99Initial value:string(4) "15.5"
100Result value:float(14.5)
101Initial value:string(4) "1e10"
102Result value:float(9999999999)
103Initial value:string(4) "199A"
104
105Deprecated: Decrement on non-numeric string has no effect and is deprecated in %s on line %d
106Result value:string(4) "199A"
107Initial value:string(4) "A199"
108
109Deprecated: Decrement on non-numeric string has no effect and is deprecated in %s on line %d
110Result value:string(4) "A199"
111Initial value:string(4) "199Z"
112
113Deprecated: Decrement on non-numeric string has no effect and is deprecated in %s on line %d
114Result value:string(4) "199Z"
115Initial value:string(4) "Z199"
116
117Deprecated: Decrement on non-numeric string has no effect and is deprecated in %s on line %d
118Result value:string(4) "Z199"
119Initial value:string(11) "Hello world"
120
121Deprecated: Decrement on non-numeric string has no effect and is deprecated in %s on line %d
122Result value:string(11) "Hello world"
123Initial value:string(4) "��"
124
125Deprecated: Decrement on non-numeric string has no effect and is deprecated in %s on line %d
126Result value:string(4) "��"
127