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