Class returning boolean value


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. class Test
  2. {
  3.  
  4. public $result;
  5.  
  6. function __construct()
  7. {
  8.  
  9.  
  10.  
  11. $this->result = TRUE;
  12.  
  13.  
  14.  
  15. }
  16.  
  17. public function __toString()
  18. {
  19.  
  20. return (string)$this->result;
  21.  
  22. }
  23. }
  24.  
  25. $test = new Test();
  26. var_dump($test->result);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.