1--TEST--
2String increment on a variety of strings
3--FILE--
4<?php
5
6$strictlyAlphaNumeric = [
7    "Az",
8    "aZ",
9    "A9",
10    "a9",
11    // Carrying values until the beginning of the string
12    "Zz",
13    "zZ",
14    "9z",
15    "9Z",
16];
17
18$strings = [
19    // Empty string
20    "",
21    // String increments are unaware of being "negative"
22    "-cc",
23    // Trailing whitespace
24    "Z ",
25    // Leading whitespace
26    " Z",
27    // Non-ASCII characters
28    "é",
29    "あいうえお",
30    "α",
31    "ω",
32    "Α",
33    "Ω",
34    // With period
35    "foo1.txt",
36    "1f.5",
37    // With multiple period
38    "foo.1.txt",
39    "1.f.5",
40];
41
42foreach ($strictlyAlphaNumeric as $s) {
43    var_dump(++$s);
44}
45foreach ($strings as $s) {
46    var_dump(++$s);
47}
48
49// Will get converted to float on the second increment as it gets changed to a
50// string interpretable as a number in scientific notation
51$s = "5d9";
52var_dump(++$s); // string(3) "5e0"
53var_dump(++$s); // float(6)
54?>
55--EXPECTF--
56string(2) "Ba"
57string(2) "bA"
58string(2) "B0"
59string(2) "b0"
60string(3) "AAa"
61string(3) "aaA"
62string(3) "10a"
63string(3) "10A"
64
65Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
66string(1) "1"
67
68Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
69string(3) "-cd"
70
71Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
72string(2) "Z "
73
74Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
75string(2) " A"
76
77Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
78string(2) "é"
79
80Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
81string(15) "あいうえお"
82
83Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
84string(2) "α"
85
86Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
87string(2) "ω"
88
89Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
90string(2) "Α"
91
92Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
93string(2) "Ω"
94
95Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
96string(8) "foo1.txu"
97
98Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
99string(4) "1f.6"
100
101Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
102string(9) "foo.1.txu"
103
104Deprecated: Increment on non-alphanumeric string is deprecated in %s on line %d
105string(5) "1.f.6"
106string(3) "5e0"
107float(6)
108