I found the following code in the cupcake forum plugin’s forum_app_model.php:
/**
* Validates two inputs against each other
* @access public
* @param array $data
* @param string $confirmField
* @return boolean
*/
public function isMatch($data, $confirmField) {
$data = array_values($data);
$var1 = $data[0];
$var2 = (isset($this->data[$this->name][$confirmField])) ? $this->data[$this->name][$confirmField] : '';
//== matches the values. Whereas === matches the values and the data type of the values
//eg
return ($var1 === $var2);
}
Can someone tell me on what is $var2 = (isset($this->data[$this->name][$confirmField])) ? $this->data[$this->name][$confirmField] : ”; in the above function? It looks like an if else stmt but i’m not understanding it.
thank you.
That’s similar to:
See: Ternary operator php