php - Use of undefined constant 0 - assumed ' 0' when using substr
迷茫
迷茫 2017-06-10 09:47:52
0
2
1242

In php version 5.6, use the substr function to intercept strings. code show as below

substr("123456", 0, 2);

AppearUse of undefined constant 0 - assumed ' 0'

The online solution is to modify error_reporting in php.ini to turn off notice. But what is this essential question? ? If you don't close this notice configuration, how to solve it? ?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
左手右手慢动作

Thanks for the invitation!

It’s not a function problem, but that you used the undefined constant 0. You can take a look at your code again. Is the 0 in your context a full-width space?

typecho

If I read it correctly, this Use of undefined constant 0 - assumed ' 0'.

0 There is a space in front of it. If it is just a space (u20), there should be no error.

I guess you used full-width spaces, causing '0' to become a variable. But in PHP, variables need to be defined with $, so this '0' is programmed as a constant.

Use of undefined constant 0

Translation: Undefined constant used.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template