I have an array that contains the following elements:
array(4) {
[0]=> array(2) { ["home"]=> string(5) "Niort" ["away"]=> string(12) "Valenciennes" }
[1]=> array(2) { ["home"]=> string(15) "Kuban Krasnodar" ["away"]=> string(3) "Ufa" }
[2]=> array(2) { ["home"]=> string(17) "Fratangelo, Bjorn" ["away"]=> string(13) "Bhambri, Yuki" }
[3]=> array(2) { ["home"]=> string(13) "VfL Wolfsburg" ["away"]=> string(15) "Bayern Mnchen" } }
and i'm trying to convert it to json array with:
while ($row = $result->fetch_assoc()) {
array_push($events, $row);
}
echo json_encode($events);
but it does not work, however, when i reduce the number of elements to 3 or less, it's work perfectly. Please, help me to understand why is this so, and if it is possible, let me know how i can convert more then 3 elements of my array.
Aucun commentaire:
Enregistrer un commentaire