Jump to content

split() and join() functions


jaArch

Recommended Posts

Yep, both split() and explode() did the same thing, so they dropped split(), same for join() and implode().

 

Not entirely true.  When join() was introduced in PHP 3.0b5 (a very long time ago) it was immediately an "alias" for implode(), which means that it does exactly (literally!) the same thing. 

 

However, split() and explode() are different functions entirely. split() uses a POSIX regular expression to break a string into pieces (sometimes the regular expression is a string of literal characters). explode() does not use regular expressions, it just splits of the characters given. So, there is some overlap in what split() and explode() can do but they're not the same at all.

 

split() was deprecated as part of the wider deprecation of all of the POSIX regex functions in PHP 5.3.0.  None of the other three functions (explode(), join(), implode()) are deprecated.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.