1
I’m taking the values of the array and trying to pass the for, but it eventually getting into loop and bringing the values 1,2,3,4,5,6....
array_push($var, $linha['data']);
array_push($var, $linha['data_th']);
array_push($var, $linha['data_fl']);
$var = array_unique($var);
for($i = 0; $i <= $var; $i++){
echo "<td><div class='data'>'$i'</div></td>";
}
The result of print_r
of $var
is:
Array ( [0] => 30/04 [1] => 03/05 [2] => [3] => 01/05 [6] => 02/05 [10] => 07/05 [12] => 04/05 [16] => 09/05 [17] => 18/05 [18] => 05/05 [27] => 10/05 [28] => 14/05 [30] => 11/05 [31] => 15/05 [34] => 16/05 [40] => 17/05 [49] => 21/05 [53] => 04/06 [55] => 22/05 [65] => 26/05 [67] => 24/05 [73] => 28/05 [75] => 25/05 [77] => 18/06 [81] => 29/05 [84] => 30/05 [87] => 31/05 [91] => 05/06 [94] => 06/06 [96] => 01/06 [101] => 15/06 [103] => 08/06 [104] => 29/06 [108] => 07/06 [109] => 12/06 [112] => 11/06 [118] => 14/06 [119] => 28/06 [128] => 00/00 [133] => 22/06 [135] => 13/06 [142] => 19/06 [145] => 20/06 [164] => 06/07 [172] => 25/06 [174] => 21/06 [181] => 26/06 [190] => 27/06 [199] => 02/07 [217] => 04/07 [218] => 15/07 [259] => 09/07 [262] => 10/07 [267] => 05/07 [271] => 08/07 [291] => 11/07 [294] => 12/07 [300] => 13/07 )
It returns the following error:
Notice: Undefined offset: 4 in C: xampp htdocs... on line 398 Notice: Undefined offset: 5 in C: xampp htdocs... on line 398 Notice: Undefined offset: 6 in C: xampp htdocs... on line 398 Notice: Undefined offset: 7 in C: xampp htdocs... on line 398 ...
Would not be
$i <= count($var)
– user60252
We need to know the arrays structure
$linha
to be able to print in the loop.– rbz