JSON массив сделать выборку
Есть JSON массив
{
"messages": [
{
"id": "[email protected]_3EB078AFDC7F617FB80B",
"body": "l];;];",
"fromMe": true,
"author": "[email protected]",
"time": 1532383438,
"chatId": "[email protected]",
"messageNumber": 5349,
"type": "chat",
"senderName": "Анна"
},
{
"id": "[email protected]_3EB02EC7D47F83A1BA3C_out",
"body": "5350",
"fromMe": true,
"author": "[email protected]",
"time": 1532383521,
"chatId": "[email protected]",
"messageNumber": 5350,
"type": "chat",
"senderName": "Я"
},
{
"id": "[email protected]_3EB07BCDB843CA954EA6_out",
"body": "5351 messageNumber",
"fromMe": true,
"author": "[email protected]",
"time": 1532383576,
"chatId": "[email protected]",
"messageNumber": 5351,
"type": "chat",
"senderName": "Я"
},
{
"id": "[email protected]_3EB078D81CBFC37DFA01_out",
"body": "5352",
"fromMe": true,
"author": "[email protected]",
"time": 1532383822,
"chatId": "[email protected]",
"messageNumber": 5352,
"type": "chat",
"senderName": "Я"
},
{
"id": "[email protected]_47C02C770C813D4BB3DF6006D15D87DC",
"body": "5353",
"fromMe": false,
"author": "[email protected]",
"time": 1532383896,
"chatId": "[email protected]",
"messageNumber": 5353,
"type": "chat",
"senderName": "Я"
}
],
"lastMessageNumber": 5353
}
Нужен код на PHP, который будет искать по условиям:
начиная с блока где messageNumber=5350 и только где [email protected] и fromMe=false , сделать выборку только по этим парамаетрам и добавить данные из этих данных в mysql - id, time(перевести из unix), chatId, messageNumber, type.