3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "dates": [{ "orderId": 60132, "typeId": 7, "date": "2021-06-03T00:00:00+02:00" }, { "orderId": 60132, "typeId": 11, "date": "2021-05-28T00:00:00+02:00" }, { "orderId": 60132, "typeId": 16, "date": "2021-05-27T20:20:28+02:00" }, { "orderId": 60132, "typeId": 2, "date": "2021-05-27T20:19:21+02:00" }, { "orderId": 60132, "typeId": 4, "date": "2021-06-02T15:31:50+02:00" } ] }'; $arr = json_decode($json, true); $result = array_filter( array_map( function ($record) {if ($record['typeId'] == 11) return $record['date'];}, $arr['dates'] ) ); var_dump($result);

preferences:
55.98 ms | 402 KiB | 5 Q