I'm having some problems with a Return statement in PHP. The thing is that, no matter what happend inside my function I always get a false value out of the function. I really think that is because of the Return statement because I try to use it in other functions and I don't get a diferent value.
public function valid_token () { if (!isset($_SESSION['token']) || $this->token != $_SESSION['token']) { $this->errors[] = "Formulario incorrecto"; } return count($this->errors)? 0 : 1; } Out of this function I always get a false value (0). The same happends when i call:
public function valid_data () { if (empty($this->sectorName) || empty($this->sectorInfo) || empty($this->sectorCat)) { $this->errors [] = "Datos incorrectos"; } return count($this->errors)? 0 : 1; } Of course, I call both functions when I have already sent the form and have set the token.