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
What u mean by query?
What are the rules to determine the “truth” of any value which is not already of the boolean type?
how to use http headers inside php? Write the statement through which it can be added?
Name some of the functions in php.
What is the difference between $name and $$name?
How to get useful error messages in php?
What is polymorphism with example in php?
How are sessions maintained?
What is meant by public, private, protected, static and final scopes?
What is difference between mysql_connect and mysqli_connect?
Which is faster for or foreach php?
Write a program to swap two numbers using php.
What is json php?
What is php oops concepts?
What is php sequence?