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

What should we do to be able to export data into an excel file?

0 Answers  


What are the rules for naming a php variable?

0 Answers  


What is php limit?

0 Answers  


Are static variables final?

0 Answers  


Is it easy to learn wordpress?

0 Answers  






What is button in html?

0 Answers  


What is a persistence cookie?

0 Answers  


How can we know that a session is started or not?

8 Answers  


How do you add a joomla Template in admin panel of joomla? Please mention the steps

3 Answers   Cognizant, T3 Softwares,


How to read one character from a file?

0 Answers  


What Is a Persistent Cookie?

0 Answers  


•How can we submit a form without a submit button

5 Answers  


Categories