Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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



How do i explode this string '||25||34||73||94||116||128' i need to have a array like thi..

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

How do i explode this string '||25||34||73||94||116||128' i need to have a array like thi..

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

Post New Answer

More PHP Interview Questions

Hi all,, im completely new to PHP, started learning just 2 days before. Can anybody tell me how to run a PHP file to see the program's output? i have created some simple program in Dreamweaver CS3 but don't know how to run it...

1 Answers  


What is a model in php?

0 Answers  


Can I use node js with php?

0 Answers  


Require_once(), require(), include(). What is difference between them?

0 Answers  


What is a procedure in php?

5 Answers   Wipro,






What is the best practice for running mysql queries in php? Consider the risk of sql injection.

0 Answers  


Explain Whitespace Characters?

0 Answers  


What is Mcrypt used for?

0 Answers  


What is the purpose of the following files having extensions: frm, myd, and myi? What these files contain?

0 Answers  


Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?

1 Answers   Rushmore Consultancy,


Steps for the payment gateway processing?

0 Answers  


What is a static variable in php?

0 Answers  






Categories