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',
)

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / nilsoft

<?php
$string = '||25||34||73||94||116||128';
$require_array =
explode("||",substr($string,2,strlen($string)-2));
print_r($require_array);
?>

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More PHP Interview Questions

Explain Magento's autoload functionality and how to instantiate classes? What is the process you take when theming a store? Talk about Magento collections and how you use them?

0 Answers  


Whether it is possible to share a single instance of a memcache between multiple php projects?

0 Answers  


Is runtime polymorphism overriding?

0 Answers  


Is php worth learning in 2019?

0 Answers  


What sized websites have you worked on in the past?

0 Answers  


Can a super () and this () keywords be in same constructor?

0 Answers  


What is the difference between require and include in php?

0 Answers  


How to implement a class named dragonball. This class must have an attribute named ballcount (which starts from 0) and a method ifoundaball. When ifoundaball is called, ballcount is increased by one. If the value of ballcount is equal to seven, then the message you can ask your wish is printed, and ballcount is reset to 0. How would you implement this class?

1 Answers  


What does the unset() function means?

0 Answers  


Write a program in php to check whether a number is prime or not?

0 Answers  


What is the difference between exception::getmessage and exception::getline?

0 Answers  


How to find a specific value in an array?

0 Answers  


Categories