fork download
  1. <?php
  2. class valida {
  3. protected $cpf;
  4.  
  5. public function cpf($cpf) {
  6. if(is_numeric($cpf) and $cpf > 11) {
  7. $this->cpf = $cpf;
  8. return $cpf;
  9. }
  10. }
  11.  
  12. }
  13. class manda extends valida {
  14. function foo($cpf) {
  15. $cpf = cpf($cpf);
  16. }
  17. }
  18.  
  19. $cpf1 = $_GET['cpf'];
  20.  
  21. $sis = new manda;
  22. echo $sis->cpf($cpf1);
Success #stdin #stdout #stderr 0.02s 23936KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Undefined index: cpf in /home/uA2W0y/prog.php on line 19