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
How to calculate the difference between two dates using php?
Which is better #define or enum?
What is csrf token and why it is required?
Tell me what is pear?
Which is used to maintain the value of a variable over different pages?
Is it possible to use com component in php?
Require_once(), require(), include(). What is difference between them?
Is apache needed for php?
What is the use of 'print' in php?
What are the methods of array in java?
What is the difference between $argv and $argc? Give example?
What are the uses of explode() function?
What is the difference between array_map () and array_shift ()?
What does it mean when it says the csrf token is invalid?
Name and explain five of the PHP error constants?