3v4l.org

run code in 300+ PHP versions simultaneously
<?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";}}}}}'; foreach ($order['order_entity']->commerce_line_items[LANGUAGE_NONE] as $delta => $item) { echo "Hello"; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Undefined constant "LANGUAGE_NONE" in /in/CunOC:5 Stack trace: #0 {main} thrown in /in/CunOC on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' (this will throw an Error in a future version of PHP) in /in/CunOC on line 5 Warning: Illegal string offset 'order_entity' in /in/CunOC on line 5 Notice: Trying to get property 'commerce_line_items' of non-object in /in/CunOC on line 5 Notice: Trying to access array offset on value of type null in /in/CunOC on line 5 Warning: Invalid argument supplied for foreach() in /in/CunOC on line 5
Output for 7.3.32 - 7.3.33
Warning: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' (this will throw an Error in a future version of PHP) in /in/CunOC on line 5 Warning: Illegal string offset 'order_entity' in /in/CunOC on line 5 Warning: Invalid argument supplied for foreach() in /in/CunOC on line 5
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
Warning: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' (this will throw an Error in a future version of PHP) in /in/CunOC on line 5 Warning: Illegal string offset 'order_entity' in /in/CunOC on line 5 Notice: Trying to get property 'commerce_line_items' of non-object in /in/CunOC on line 5 Warning: Invalid argument supplied for foreach() in /in/CunOC on line 5
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' in /in/CunOC on line 5 Warning: Illegal string offset 'order_entity' in /in/CunOC on line 5 Notice: Trying to get property of non-object in /in/CunOC on line 5 Warning: Invalid argument supplied for foreach() in /in/CunOC on line 5
Output for 5.2.1 - 5.2.17, 5.3.0 - 5.3.29
Notice: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' in /in/CunOC on line 5 Notice: Trying to get property of non-object in /in/CunOC on line 5 Warning: Invalid argument supplied for foreach() in /in/CunOC on line 5
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Notice: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' in /in/CunOC on line 5
Process exited with code 139.
Output for 4.3.0 - 4.3.10, 4.4.0 - 4.4.9
Notice: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' in /in/CunOC on line 5 Warning: Invalid argument supplied for foreach() in /in/CunOC on line 5
Output for 4.3.11
Notice: Use of undefined constant LANGUAGE_NONE - assumed 'LANGUAGE_NONE' in /in/CunOC on line 5

preferences:
262.06 ms | 401 KiB | 353 Q