Post #1039613
2026-03-23 21:02 UTC
preg_split() splits #PHP strings with regexes, captures the separators and can handle an empty regex.
You don't need that everyday, but when you do, #PHP has it!
#phptip #phptrick
https://php-tips.readthedocs.io/en/latest/tips/preg_split.html
Replies (1)
-
@bobmagicii@phpc.social 2026-03-23 21:18
@dseguy@phpc.social yeah thats pretty wild. when i need to split its because its a fixed format. the odds of me remembering preg_split exists over just complaining about the input data is not very high 🤣