seany123 Posted May 2, 2009 Share Posted May 2, 2009 im trying to do some variables, i wqas just wondering if someone can verify this would work? <?php $exploss1 = ($player->level - $enemy->level * 100 + 100); if($exploss1 <= 1) { $exploss1 = rand(0, 10); } Quote Link to comment Share on other sites More sharing options...
Mchl Posted May 2, 2009 Share Posted May 2, 2009 The syntax is correct. Quote Link to comment Share on other sites More sharing options...
seany123 Posted May 2, 2009 Author Share Posted May 2, 2009 okay thankyou, i was just wondering because i keep seeing stuff like ... $exploss1 = ($player->level - $enemy->level * 100 + 100) <= 0 ? ($exploss1 = rand(0, 10) or something like that.. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 2, 2009 Share Posted May 2, 2009 That's a ternary operator. It's a kind-of short-hand for if statements. Quote Link to comment Share on other sites More sharing options...
seany123 Posted May 2, 2009 Author Share Posted May 2, 2009 okay well ill stick to what i know, cheers for the help 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.