| Posted by J.O. Aho on 06/14/35 11:40 
Smiley wrote:> I taught myself PHP a few years ago and I use it frequently.  Recently I
 > downloaded a PHP script built by somebody else, and came across this piece
 > of code:
 >
 > $password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password']
 > : '';
 >
 > I have never seen the question mark or colon used in this way before.  I
 > can't find any reference to it in my PHP book.  Please tell me what it
 > means.
 
 
 It's a form of an if-statement and you could translate it to:
 
 if(isset($HTTP_POST_VARS['password'])) {
 $password=$HTTP_POST_VARS['password'];
 } else {
 $password='';
 }
 
 The script you are using is a bit old, $HTTP_POST_VARS shouldn't anymore be
 used, but $_POST.
 
 
 //Aho
  Navigation: [Reply to this message] |