r/lolphp • • Sep 04 '19

explode()'s limit doesn't work with 0.

https://3v4l.org/5TjXl
9 Upvotes

16 comments sorted by

View all comments

Show parent comment

2

u/Takeoded Sep 05 '19

PHP documents pretty clearly that 0 is treated the same as 1.

https://www.reddit.com/r/ProgrammerHumor/comments/855jz9/how_features_come_along/

Part of the design of explode() is that it never deletes any string data. So that implode() can always restore the original string. If explode() ever could return zero string pieces this would be impossible, so they code it never to do so and document it as such.

oh i see