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 is session and why do we use it?
How can you create a session in php?
How to join multiple strings into a single string?
What is implode() in php?
When to use single quotes, double quotes, and backticks?
Why laravel is the best php framework in 2019?
Explain about PHP cookies?
How long will it take to learn php?
What is the maximum size of a database in mysql?
What is the use of friend function in php?
When do you use define() and when do you use const. What are the main differences between those two?
How long is a php session valid?
How to create an empty array in php?
What is the difference between php4 and php5?
What is PECL?