Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do i explode this string '||25||34||73||94||116||128' i
need to have a array like this

array (
0 => '25',
1 => '34',
2 => '73',
3 => '94',
4 => '116',
5 => '128'
)

explode("||", $array); didnt work for me i get this array

array (
0 => '',
1 => '25',
2 => '34',
3 => '73',
4 => '94',
5 => '116',
6 => '128',
)

Answer Posted / rekha_sri

Use the following program.It will remove the beginning ||.

?php
$string='||25||34||73||94||116||128';
$array = explode('||', trim($string, '|'));
print_r($array);
?>
~

Is This Answer Correct ?    23 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is session and why do we use it?

1051


How can you create a session in php?

1065


How to join multiple strings into a single string?

964


What is implode() in php?

1087


When to use single quotes, double quotes, and backticks?

980


Why laravel is the best php framework in 2019?

955


Explain about PHP cookies?

1060


How long will it take to learn php?

980


What is the maximum size of a database in mysql?

1002


What is the use of friend function in php?

977


When do you use define() and when do you use const. What are the main differences between those two?

1061


How long is a php session valid?

1014


How to create an empty array in php?

1108


What is the difference between php4 and php5?

1067


What is PECL?

1196