I have a php script and I was modeling my script off another script and the script collects a variable (html) from a form where $html is defined by a radio group with two options:
Option 1: value='0' Plain text
Option 2: value='1' HTML code
Then when processing there is code:
$html = $_POST['html'] ? 1 : 0;
if ($html) {
code here
} else {
code here
}
So my question is: What does
$html = $_POST['html'] ? 1 : 0;
actually accomplish and what does it store in the variable $html?
Ok, I know what the $_POST[] does. What I want to know is what the ? 1 : 0; does. It obviously returns a true or false (or 1 or 0) value so that the next if statement can be tested. Any ideas?
Option 1: value='0' Plain text
Option 2: value='1' HTML code
Then when processing there is code:
$html = $_POST['html'] ? 1 : 0;
if ($html) {
code here
} else {
code here
}
So my question is: What does
$html = $_POST['html'] ? 1 : 0;
actually accomplish and what does it store in the variable $html?
Ok, I know what the $_POST[] does. What I want to know is what the ? 1 : 0; does. It obviously returns a true or false (or 1 or 0) value so that the next if statement can be tested. Any ideas?