function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return '

You have no items in your shopping cart

'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return '

You have '.count($items).' item'.$s.' in your shopping cart

'; } }