I have the following code
<?php
while($data = $QuerySearch->fetch(PDO::FETCH_ASSOC)){
$js[] = $data;
}
$r = array();
$arr = array();
foreach($js as $k=>$v){
foreach($v as $col=>$c){
$arr[] = $c;
}
array_push($r, $arr);
}
$r = array_map('htmlentities', $arr);
if(isset($r)){
echo 'Existe<br>';
if(is_array($arr)){
echo 'Tb existe';
}else{
echo 'nao existe arr';
}
}else{
echo 'nao existe';
}
echo print_r($r);
?>
As you can see, the array is being formed, only that it does not display the array. When we place echo
% in place of% arr[]
he usually displays the data, now we place echo json_encode($arr);
% it becomes empty, and the checks I made up displays like this:
Existe
Não existe arr
That is, there $arr[]
% but he says it's not a array()
%