jaArch Posted October 11, 2011 Share Posted October 11, 2011 How would I go about using the split() and join() functions to convert a string into an array? Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/ Share on other sites More sharing options...
requinix Posted October 11, 2011 Share Posted October 11, 2011 By not using them and using explode (or preg_split()) and implode instead. Oh, and click the links and read the manual pages to learn how to use them. Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/#findComment-1278382 Share on other sites More sharing options...
jaArch Posted October 11, 2011 Author Share Posted October 11, 2011 Is there a reason why they were renamed? Lol Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/#findComment-1278400 Share on other sites More sharing options...
jcbones Posted October 11, 2011 Share Posted October 11, 2011 Yep, both split() and explode() did the same thing, so they dropped split(), same for join() and implode(). Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/#findComment-1278411 Share on other sites More sharing options...
jaArch Posted October 11, 2011 Author Share Posted October 11, 2011 Ah...interesting Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/#findComment-1278415 Share on other sites More sharing options...
salathe Posted October 12, 2011 Share Posted October 12, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/#findComment-1278516 Share on other sites More sharing options...
jcbones Posted October 13, 2011 Share Posted October 13, 2011 Sorry, it is hard to part sarcasm into a post. Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/#findComment-1279165 Share on other sites More sharing options...
salathe Posted October 14, 2011 Share Posted October 14, 2011 Sorry, it is hard to part sarcasm into a post. Not at all, try harder. Quote Link to comment https://forums.phpfreaks.com/topic/248927-split-and-join-functions/#findComment-1279244 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.