PHP equivalents to NthField() and CountFields()

Quite a few years ago I decided to port those two functions to PHP. This is how they look like: https://www.maxprog.com/site/blog/post.php?id=813
Personally I use those two functions very often in Xojo, when the text is not too big since the execution speed decrease quite fast as the text grows in size. Having the equivalent in PHP saves time. At least for me.