3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $order = 'a:1:{s:12:"order_entity";O:8:"stdClass":24:{s:3:"uid";s:1:"1";s:6:"status";s:17:"checkout_complete";s:4:"type";s:14:"commerce_order";s:8:"order_id";s:8:"10436081";s:12:"order_number";s:8:"10436081";s:11:"revision_id";N;s:4:"mail";s:20:"commerce@example.com";s:4:"data";a:0:{}s:7:"created";i:1340202197;s:7:"changed";i:1340202197;s:8:"hostname";s:11:"10.45.76.81";s:16:"field_global_uid";a:1:{s:3:"und";a:1:{i:0;a:1:{s:5:"value";s:9:"301214635";}}}s:12:"external_uid";a:1:{s:3:"und";a:1:{i:0;a:1:{s:5:"value";s:9:"301214635";}}}s:11:"application";a:1:{s:3:"und";a:1:{i:0;a:1:{s:5:"value";s:10:"life_cover";}}}s:6:"is_new";b:1;s:18:"revision_timestamp";i:1340202197;s:17:"revision_hostname";s:11:"10.45.76.81";s:12:"revision_uid";s:1:"1";s:20:"commerce_order_total";a:1:{s:3:"und";a:1:{i:0;a:3:{s:6:"amount";i:0;s:13:"currency_code";s:3:"GBP";s:4:"data";a:1:{s:10:"components";a:1:{i:0;a:3:{s:4:"name";s:10:"base_price";s:5:"price";a:3:{s:6:"amount";i:0;s:13:"currency_code";s:3:"GBP";s:4:"data";a:0:{}}s:8:"included";b:1;}}}}}}s:3:"log";s:0:"";s:27:"field_order_completion_date";a:1:{s:3:"und";a:1:{i:0;a:4:{s:5:"value";i:0;s:8:"timezone";s:13:"Europe/London";s:11:"timezone_db";s:3:"UTC";s:9:"date_type";s:9:"datestamp";}}}s:26:"field_order_published_date";a:1:{s:3:"und";a:1:{i:0;a:4:{s:5:"value";i:0;s:8:"timezone";s:13:"Europe/London";s:11:"timezone_db";s:3:"UTC";s:9:"date_type";s:9:"datestamp";}}}s:17:"field_failed_sync";a:1:{s:3:"und";a:1:{i:0;a:1:{s:5:"value";s:2:"-1";}}}s:14:"field_imported";a:1:{s:3:"und";a:1:{i:0;a:1:{s:5:"value";s:1:"0";}}}}}'; $order = unserialize($order); print_R($order); foreach ($order['order_entity']->commerce_line_items['und'] as $delta => $item) { echo "Hello"; }
Output for 5.2.6 - 5.6.28, 7.0.0 - 7.1.0
Array ( [order_entity] => stdClass Object ( [uid] => 1 [status] => checkout_complete [type] => commerce_order [order_id] => 10436081 [order_number] => 10436081 [revision_id] => [mail] => commerce@example.com [data] => Array ( ) [created] => 1340202197 [changed] => 1340202197 [hostname] => 10.45.76.81 [field_global_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [external_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [application] => Array ( [und] => Array ( [0] => Array ( [value] => life_cover ) ) ) [is_new] => 1 [revision_timestamp] => 1340202197 [revision_hostname] => 10.45.76.81 [revision_uid] => 1 [commerce_order_total] => Array ( [und] => Array ( [0] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( [components] => Array ( [0] => Array ( [name] => base_price [price] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( ) ) [included] => 1 ) ) ) ) ) ) [log] => [field_order_completion_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_order_published_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_failed_sync] => Array ( [und] => Array ( [0] => Array ( [value] => -1 ) ) ) [field_imported] => Array ( [und] => Array ( [0] => Array ( [value] => 0 ) ) ) ) ) Notice: Undefined property: stdClass::$commerce_line_items in /in/ffgNM on line 7 Warning: Invalid argument supplied for foreach() in /in/ffgNM on line 7
Output for hhvm-3.10.0 - 3.12.0
Array ( [order_entity] => stdClass Object ( [uid] => 1 [status] => checkout_complete [type] => commerce_order [order_id] => 10436081 [order_number] => 10436081 [revision_id] => [mail] => commerce@example.com [data] => Array ( ) [created] => 1340202197 [changed] => 1340202197 [hostname] => 10.45.76.81 [field_global_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [external_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [application] => Array ( [und] => Array ( [0] => Array ( [value] => life_cover ) ) ) [is_new] => 1 [revision_timestamp] => 1340202197 [revision_hostname] => 10.45.76.81 [revision_uid] => 1 [commerce_order_total] => Array ( [und] => Array ( [0] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( [components] => Array ( [0] => Array ( [name] => base_price [price] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( ) ) [included] => 1 ) ) ) ) ) ) [log] => [field_order_completion_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_order_published_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_failed_sync] => Array ( [und] => Array ( [0] => Array ( [value] => -1 ) ) ) [field_imported] => Array ( [und] => Array ( [0] => Array ( [value] => 0 ) ) ) ) ) Notice: Undefined property: stdClass::$commerce_line_items in /in/ffgNM on line 7 Warning: Invalid argument supplied for foreach() in /in/ffgNM on line 9
Output for 5.2.1 - 5.2.5
Array ( [order_entity] => stdClass Object ( [uid] => 1 [status] => checkout_complete [type] => commerce_order [order_id] => 10436081 [order_number] => 10436081 [revision_id] => [mail] => commerce@example.com [data] => Array ( ) [created] => 1340202197 [changed] => 1340202197 [hostname] => 10.45.76.81 [field_global_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [external_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [application] => Array ( [und] => Array ( [0] => Array ( [value] => life_cover ) ) ) [is_new] => 1 [revision_timestamp] => 1340202197 [revision_hostname] => 10.45.76.81 [revision_uid] => 1 [commerce_order_total] => Array ( [und] => Array ( [0] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( [components] => Array ( [0] => Array ( [name] => base_price [price] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( ) ) [included] => 1 ) ) ) ) ) ) [log] => [field_order_completion_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_order_published_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_failed_sync] => Array ( [und] => Array ( [0] => Array ( [value] => -1 ) ) ) [field_imported] => Array ( [und] => Array ( [0] => Array ( [value] => 0 ) ) ) ) ) Notice: Undefined property: stdClass::$commerce_line_items in /in/ffgNM on line 7 Warning: Invalid argument supplied for foreach() in /in/ffgNM on line 7
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.2.0
Array ( [order_entity] => stdClass Object ( [uid] => 1 [status] => checkout_complete [type] => commerce_order [order_id] => 10436081 [order_number] => 10436081 [revision_id] => [mail] => commerce@example.com [data] => Array ( ) [created] => 1340202197 [changed] => 1340202197 [hostname] => 10.45.76.81 [field_global_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [external_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [application] => Array ( [und] => Array ( [0] => Array ( [value] => life_cover ) ) ) [is_new] => 1 [revision_timestamp] => 1340202197 [revision_hostname] => 10.45.76.81 [revision_uid] => 1 [commerce_order_total] => Array ( [und] => Array ( [0] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( [components] => Array ( [0] => Array ( [name] => base_price [price] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( ) ) [included] => 1 ) ) ) ) ) ) [log] => [field_order_completion_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_order_published_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_failed_sync] => Array ( [und] => Array ( [0] => Array ( [value] => -1 ) ) ) [field_imported] => Array ( [und] => Array ( [0] => Array ( [value] => 0 ) ) ) ) ) Warning: Invalid argument supplied for foreach() in /in/ffgNM on line 7
Output for 4.3.11
Array ( [order_entity] => stdClass Object ( [uid] => 1 [status] => checkout_complete [type] => commerce_order [order_id] => 10436081 [order_number] => 10436081 [revision_id] => [mail] => commerce@example.com [data] => Array ( ) [created] => 1340202197 [changed] => 1340202197 [hostname] => 10.45.76.81 [field_global_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [external_uid] => Array ( [und] => Array ( [0] => Array ( [value] => 301214635 ) ) ) [application] => Array ( [und] => Array ( [0] => Array ( [value] => life_cover ) ) ) [is_new] => 1 [revision_timestamp] => 1340202197 [revision_hostname] => 10.45.76.81 [revision_uid] => 1 [commerce_order_total] => Array ( [und] => Array ( [0] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( [components] => Array ( [0] => Array ( [name] => base_price [price] => Array ( [amount] => 0 [currency_code] => GBP [data] => Array ( ) ) [included] => 1 ) ) ) ) ) ) [log] => [field_order_completion_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_order_published_date] => Array ( [und] => Array ( [0] => Array ( [value] => 0 [timezone] => Europe/London [timezone_db] => UTC [date_type] => datestamp ) ) ) [field_failed_sync] => Array ( [und] => Array ( [0] => Array ( [value] => -1 ) ) ) [field_imported] => Array ( [und] => Array ( [0] => Array ( [value] => 0 ) ) ) ) )