parapet74 Posted March 22, 2011 Report Posted March 22, 2011 Trying to understand some php code... What do the ? and : operators do? What will be in $s? $cart = $_SESSION['cart']; $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; Quote
falkencreative Posted March 22, 2011 Report Posted March 22, 2011 It's an alternate syntax for if () { ... } else { ... } That means if the count of $items is > 1, $s will equal 's', otherwise it will equal nothing (''). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.