parapet74 Posted March 22, 2011 Report Share 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 Link to comment Share on other sites More sharing options...
falkencreative Posted March 22, 2011 Report Share 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 Link to comment Share on other sites More sharing options...
parapet74 Posted March 24, 2011 Author Report Share Posted March 24, 2011 Ah... Thank you. Quote Link to comment Share on other sites More sharing options...
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.