File tree Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,73 @@ NULL is NOT numeric
104
104
</screen >
105
105
</example >
106
106
</para >
107
+
108
+ <para >
109
+ <example >
110
+ <title ><function >is_numeric</function > with whitespace</title >
111
+ <programlisting role =" php" >
112
+ <![CDATA[
113
+ <?php
114
+ $tests = [
115
+ " 42",
116
+ "42 ",
117
+ " 9001", // non-breaking space
118
+ "9001 ", // non-breaking space
119
+ ];
120
+
121
+ foreach ($tests as $element) {
122
+ if (is_numeric($element)) {
123
+ echo var_export($element, true) . " is numeric", PHP_EOL;
124
+ } else {
125
+ echo var_export($element, true) . " is NOT numeric", PHP_EOL;
126
+ }
127
+ }
128
+ ?>
129
+ ]]>
130
+ </programlisting >
131
+ &example.outputs.8;
132
+ <screen >
133
+ <![CDATA[
134
+ ' 42' is numeric
135
+ '42 ' is numeric
136
+ ' 9001' is NOT numeric
137
+ '9001 ' is NOT numeric
138
+ ]]>
139
+ </screen >
140
+ &example.outputs.7;
141
+ <screen >
142
+ <![CDATA[
143
+ ' 42' is numeric
144
+ '42 ' is NOT numeric
145
+ ' 9001' is NOT numeric
146
+ '9001 ' is NOT numeric
147
+ ]]>
148
+ </screen >
149
+ </example >
150
+ </para >
151
+ </refsect1 >
152
+
153
+ <refsect1 role =" changelog" >
154
+ &reftitle.changelog;
155
+ <informaltable >
156
+ <tgroup cols =" 2" >
157
+ <thead >
158
+ <row >
159
+ <entry >&Version; </entry >
160
+ <entry >&Description; </entry >
161
+ </row >
162
+ </thead >
163
+ <tbody >
164
+ <row >
165
+ <entry >8.0.0</entry >
166
+ <entry >
167
+ Numeric strings ending with whitespace (<literal >"42 "</literal >) will now
168
+ return &true; . Previously, &false; was return instead.
169
+ </entry >
170
+ </row >
171
+ </tbody >
172
+ </tgroup >
173
+ </informaltable >
107
174
</refsect1 >
108
175
109
176
<refsect1 role =" seealso" >
You can’t perform that action at this time.
0 commit comments