ted_chou12 Posted March 20, 2007 Share Posted March 20, 2007 $username = isset($_POST["username"])?$_POST["username"]:""; This is a piece of code from a script I have found, but I dont understand what this means, I tried searching it in manual, however, only found about the isset() not the ?:"" parts, can anyone kindly explain to me what the code means? Thanks Ted Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 20, 2007 Share Posted March 20, 2007 That's called the ternary operator. It's the equivalent of saying the following: <?php if (isset($_POST['username'])) { $username = $_POST['username']; } else { $username = ''; } ?> Quote Link to comment Share on other sites More sharing options...
per1os Posted March 20, 2007 Share Posted March 20, 2007 if the post username isset then (?) set username to post username else ( set it to "" Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted March 20, 2007 Author Share Posted March 20, 2007 thanks, I see how it works now. 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.