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
Notice: Undefined property: stdClass::$commerce_line_items in /in/Ct3ZV on line 7 Warning: Invalid argument supplied for foreach() in /in/Ct3ZV on line 7
Output for hhvm-3.12.0 - 3.13.2
Notice: Undefined property: stdClass::$commerce_line_items in /in/Ct3ZV on line 7 Warning: Invalid argument supplied for foreach() in /in/Ct3ZV on line 9
Output for hhvm-3.10.0
Notice: Undefined property: stdClass::$commerce_line_items in /in/Ct3ZV on line -1 Warning: Invalid argument supplied for foreach() in /in/Ct3ZV on line -1
Output for 5.2.1 - 5.2.5
Notice: Undefined property: stdClass::$commerce_line_items in /in/Ct3ZV on line 7 Warning: Invalid argument supplied for foreach() in /in/Ct3ZV on line 7
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.2.0
Warning: Invalid argument supplied for foreach() in /in/Ct3ZV on line 7
Output for 4.3.11