PHP Notice: Array to string conversion Error -
this question has answer here:
- reference - error mean in php? 29 answers
<?php $arr00 = array(1,5,7); $arr01 = array(9,6,3,$arr00); $arr02 = array(4,8,12,$arr01); echo $length = count($arr00); echo "<br />"; echo $length1 = count($arr01); echo "<br />"; echo $length2 = count($arr02); echo "<br />"; for($i = 0; $i < $length; $i++) for($j = 0; $j < $i; $j++) for($k = 0; $k < $j; $k++){ echo "<pre>"; print_r($arr02); echo "</pre>"; } foreach ($arr00 $value) { echo $value." "; } foreach ($arr01 $value1) { echo $value1." "; } foreach ($arr02 $value2) { echo $value2." "; }
notice: array string conversion in c:\xampp\htdocs\mywebpage\3dimns.php on line 34 array 4 8 12 notice: array string conversion in c:\xampp\htdocs\mywebpage\3dimns.php on line 39 array
your problem starts here:
$arr00 = array(1,5,7); $arr01 = array(9,6,3,$arr00); $arr02 = array(4,8,12,$arr01);
the fourth element of both $arr01
, $arr02
array, when loop on these arrays , try echo
out value, message 4th iteration of loop.
what want do?
if want combine both arrays, should example array_merge()
(although depends on how want handle duplicates):
$arr00 = array(1,5,7); $arr01 = array_merge( array(9,6,3), $arr00 );
Comments
Post a Comment