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

Facebook Login
Site Registration

What is the use of explode() function in PHP ?

0 votes
49 views
What is the use of explode() function in PHP ?
posted Dec 26, 2017 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

0 votes

The explode() function breaks a string into an array.It Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.
Example:

$values  = "val1 val2 val3";
$splitValues = explode(" ", $values);
echo $splitValues[0]; // val1
echo $splitValues[1]; // val2
echo $splitValues[3]; // val3
answer Dec 26, 2017 by Madhavi Latha
0 votes

The explode() function breaks a string into an array. It return an array of string, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.

EX.

$val = "val1 val2 val3";
$splitVal = explode(" ", &val);
echo $splitVal [0];
echo $splitVal [1];
echo $splitVal [2];
answer Oct 25 by Siddhi Patel
0 votes

The explode() function breaks a string into an array.

syntax: explode(separator,string,limit)

example :
<?php $str = "Hello world. It's a beautiful day."; print_r (explode(" ",$str)); ?>

answer Nov 4 by Ifour Parth
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
...