shaffiq_fiq88 Posted May 10, 2011 Share Posted May 10, 2011 Hello.I'm new to PHP, a beginner. I downloaded a text editor and the only server scripting use by the text editor is PHP. I want to rewrite the script to ASP server scripting. However, I found a syntax that I don't understand. I'd tried searching in google and W3Schools.com but didn't find its function. $_GET['dir'] = $_POST['dir'] ? $_POST['dir'] : $_GET['dir']; What is the function of that syntax? Link to comment Share on other sites More sharing options...
thescientist Posted May 10, 2011 Share Posted May 10, 2011 it's a statement using a ternary operator, which in simple cases can replace an if/else statement.http://php.net/manual/en/language.operators.phpi.e. if($_POST['dir']){ $_GET['dir'] = $_POST['dir'];}else{ $_GET['dir'] = $_GET['dir'];}; Link to comment Share on other sites More sharing options...
shaffiq_fiq88 Posted May 10, 2011 Author Share Posted May 10, 2011 it's a statement using a ternary operator, which in simple cases can replace an if/else statement.http://php.net/manual/en/language.operators.phpi.e.if($_POST['dir']){ $_GET['dir'] = $_POST['dir'];}else{ $_GET['dir'] = $_GET['dir'];}; Thanks. Now, I understand it. Thanks so much. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.