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
Do you know what is php?
How to get the value of current session id?
What is the difference between php traits vs interfaces?
Is polymorphism inherited?
What is a http session?
What are magic constants in php?
How do I find environment variables?
How does php and apache work?
What is putenv?
Which php framework is best?
How to take a substring from a given string?
Inside a php function, what param needs to be set in order to access a global variable?
What is baseurl?
Can you define an array argument as a reference type?
What is sticky form in php?