3v4l.org

run code in 300+ PHP versions simultaneously
<?php global $smarty; $itemCount = 0; $productKeys = array('domains', 'other', 'stuff'); $language = $smarty->get_template_vars('language'); foreach ($productKeys as $productKey) { if (!empty($_SESSION['cart'][$productKey])) { $itemCount += count($_SESSION['cart'][$productKey]); } } if (($itemCount += count($_SESSION['cart'][$productKey])) > 1): echo "<a href='https://mysite.com/checkout/go'><li class='header-icon'><div class='header-right-icon-cart'></div></li>"; if ($language == us) { echo "<li class='header-right-chat'>{$itemCount} items</li></a>"; } else { echo "<li class='header-right-chat'>{$itemCount} itens</li></a>"; } elseif (($itemCount += count($_SESSION['cart'][$productKey])) == 1): echo "<a href='https://mysite.com/checkout/go'><li class='header-icon'><div class='header-right-icon-cart'></div></li>"; echo "<li class='header-right-chat'>{$itemCount} item</li></a>"; endif; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to a member function get_template_vars() on null in /in/53dUH:5 Stack trace: #0 {main} thrown in /in/53dUH on line 5
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.25 ms | 401 KiB | 8 Q