This code worked last week, and I don't remember changing this code recently, but for some reason it stopped working today.
I've narrowed down the issue, but I'm confused about it. Basically, $fields = sizeof($dataArray[$r]);
yields $fields = 1
, but as you can see in the image below, ECHO json_encode($dataArray);
demonstrates that $fields = 9
should be observed.
$dataArray = $_POST['array'];
$validRows = array();
$invalidRows = array();
echo sizeof($dataArray); // correct output
for($r = 0; $r < sizeof($dataArray); $r++){
$fields = sizeof($dataArray[$r]); // $fields is not what I expect
ECHO json_encode($dataArray); // see image below (sent to javaScript alert)
ECHO sizeof($fields); // returns 1
...
}
ECHO json_encode($dataArray);
Seen in a javaScript alert
What's my issue here?