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?
Asked
Active
Viewed 24 times
0
-
2_split_ has been deprecated as of PHP 5.3.0 and has been removed with PHP 7.0. – lukas.j Jun 04 '22 at 19:19
-
1what part of https://www.php.net/manual/en/function.explode.php is unclear? – Iłya Bursov Jun 04 '22 at 19:23
-
NEITHER of these functions are used for "for removing commas from array" – Your Common Sense Jun 05 '22 at 07:27
1 Answers
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