2
I was studying a little 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 is passed as a parameter callback
calling another function.
I have already read the PHP documentation but I found it difficult to understand. A callback
is used to call as a parameter a function within another function, is this ?
Thanks in advance.