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
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 |
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 |
How to call a php function from another php file?
How to Define a Constant in PHP? Is $ symbol necessary?
How to open a file in php?
What is the php function that removes the last element of the array and returns it?
How to communicate with sockets in php?
What are include() and require() functions?
Explain the casts allowed in PHP?
if you run the app program all vendor open items are cleared but is it possible to reverse the again again open items please tell me the answer
How to create an array of a group of items inside an html form?
Tell me how to strip whitespace (or other characters) from the beginning and end of a string?
How many functions are there in php?
How to reset/destroy a cookie?