3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{"checks":{"customer_credentials":{"passed":true,"performedAt":"2022-05-14T10:53:25+00:00","payload":{"createdAt":"2022-05-13T21:33:44+00:00"}},"customer_address":{"passed":true,"performedAt":"2022-05-14T10:53:26+00:00","payload":{"createdAt":"2022-05-13T21:33:44+00:00"}},"client_application":{"passed":true,"performedAt":"2022-05-14T10:53:26+00:00","payload":{"applicationId":"cccccccc-0003-cccc-cccc-cccccccccccc","createdAt":"2022-05-13T21:33:45+00:00"}},"application_notification":{"passed":true,"performedAt":"2022-05-14T10:53:26+00:00","payload":{"createdAt":"2022-05-13T21:33:54+00:00"}},"test_notification":{"passed":false,"performedAt":"2022-05-14T10:53:26+00:00"},"payment_countries":{"passed":true,"performedAt":"2022-05-14T10:53:26+00:00","payload":{"countries":["GB","DE","IT","NO","LT","FI","SE","BR"]}},"payment_providers":{"passed":true,"performedAt":"2022-05-14T10:53:26+00:00","payload":{"providers":["Volt","Yapily","Neonomics","Token"]}},"bank_account":{"passed":true,"performedAt":"2022-05-14T10:53:26+00:00","payload":{"createdAt":"2022-05-13T21:33:54+00:00"}},"first_successful_payment":{"passed":false,"performedAt":"2022-05-14T10:53:26+00:00"},"delivered_notification":{"passed":false,"performedAt":"2022-05-14T10:53:26+00:00"}}}'; $data = \json_decode($json, true, 512, JSON_THROW_ON_ERROR); foreach ($data['checks'] as $checkName => $checkData) { $date = new DateTime($checkData['performedAt']); var_dump($checkName, $date); }
Output for 7.4.0 - 7.4.29, 8.0.1 - 8.0.19, 8.1.0 - 8.1.6
string(20) "customer_credentials" object(DateTime)#1 (3) { ["date"]=> string(26) "2022-05-14 10:53:25.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(16) "customer_address" object(DateTime)#2 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(18) "client_application" object(DateTime)#1 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(24) "application_notification" object(DateTime)#2 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(17) "test_notification" object(DateTime)#1 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(17) "payment_countries" object(DateTime)#2 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(17) "payment_providers" object(DateTime)#1 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(12) "bank_account" object(DateTime)#2 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(24) "first_successful_payment" object(DateTime)#1 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } string(22) "delivered_notification" object(DateTime)#2 (3) { ["date"]=> string(26) "2022-05-14 10:53:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }

preferences:
25.68 ms | 414 KiB | 5 Q