I was studying a bit of PHP until I came across this code:
$this->form_validation->set_rules("nome", "nome", "required|min_length[5]|callback_nao_tenha_a_palavra_melhor");
public function nao_tenha_a_palavra_melhor($nome) {
$posicao = strpos($nome, "melhor");
if($posicao != false) {
return TRUE;
} else {
$this->form_validation->set_message("nao_tenha_a_palavra_melhor", "O campo '%s' não pode conter a palavra 'melhor'");
return FALSE;
}
Within the form validation function, a callback
that passes another function is passed as a parameter.
I have read the PHP documentation but I had difficulty understanding. A callback
is used to call as a parameter a function inside another function, is it?
Thank you in advance.