top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

PHP: What is the difference between Split and Explode?

+2 votes
119 views
PHP: What is the difference between Split and Explode?
posted Mar 26, 2014 by Riteshwar

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

The split() function splits the string into an array using a regular expression and returns an array.
The explode() function splits the string by string.

split uses regular expressions, while explode works with delimiter characters and split is deprecated in PHP 5.3.

Ex:
split(',','Hi, and Where are you');
returns array('Hi,', 'and Where are you')

explode('and','Hi, and Where are you');
returns array('Hi,', 'Where are you')

answer Mar 26, 2014 by Pavan P Naik
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...