0

I'm little confused with split and explode function as they both are using for removing commas from array so why two functions? can any body describe it?

1 Answers1

0

The function split as mentioned as in the document:

was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.

Currently we have str_split that does something different; It requires two arguments: A string and a chunk size. In some cases you need to split a string by a specific character, and you use explode instead of str_split.

str_split('Hello world', 2); // ["He", "ll", "o ", "wo", "rl", "d"]
explode(' ', 'Hello world'); // ["Hello", "world"]
WebPajooh
  • 98
  • 6