Implode, then explode, and weirdly a digit shows up
Posted: Mon Jul 04, 2011 7:41 pm
Hi all,
I just can't find anything on the internet with regards to this issue (not much of an issue to be honest, just curious why this is happening). So here's the code:
and this gives me the following output:
1 * 2 * 3 * 5 * 8 * 13 * 21
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 5
[4] => 8
[5] => 13
[6] => 21
)
1
Notice that weird "1" at the end? For the life of me I can't figure out why it's there. I'm using PHP 5.3 (latest installation of xampp).
Thanks in advance.
Bali.
I just can't find anything on the internet with regards to this issue (not much of an issue to be honest, just curious why this is happening). So here's the code:
Code: Select all
<?php $array1 = array(1,2,3,5,8,13,21); ?>
<?php echo $string1 = implode(" * ",$array1); ?><br/>
<pre><?php echo print_r(explode(" * ",$string1)); ?></pre><br />
1 * 2 * 3 * 5 * 8 * 13 * 21
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 5
[4] => 8
[5] => 13
[6] => 21
)
1
Notice that weird "1" at the end? For the life of me I can't figure out why it's there. I'm using PHP 5.3 (latest installation of xampp).
Thanks in advance.
Bali.