Getting 50 records from php array
I have a json file that I am converting to an array and then trying to get 50 elements from the array.
But for some reason my code doesn't work and it throws 212 elements instead of 50
Check out my code below:
$json_file = file_get_contents("/directory/jsonfile.json");
$json_data = json_decode($json_file, true);
$json_data = array_slice((array)$json_data, 0, 50);
print_r (array_count_values($json_data)); // this still showing 212 results
+3
source to share