WHAT IS THE DIFFERENCE BETWEEN EXPLODE AND SPLIT?

Awadhendra Tiwari

Total Post:510

Points:2550
Posted by  Awadhendra Tiwari
PHP 
PHP
 2819  View(s)
Ratings:
Rate this:
  1. Awadhendra Tiwari

    Post:510

    Points:2550
    What is the difference between explode and split?

    Split function splits string into array by regular expression. Explode splits a string into array by string.

    For Example:

    explode(" and", "India and Pakistan and Srilanka");

    split(" :", "India : Pakistan : Srilanka");

    Both of these functions will return an array that contains India, Pakistan, and Srilanka.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!