fork download
  1. <?php
  2. function getToDaChoppa($that = false) {
  3. $class = $that ? get_class($that) : '';
  4. if($class == "Choppa") {
  5. $foo = "We're inside";
  6. } else {
  7. $foo = "We're outside";
  8. }
  9. echo $foo;
  10. }
  11.  
  12. class Choppa {
  13. public function getStatus() {
  14. getToDaChoppa($this);
  15. }
  16. }
  17.  
  18.  
  19. getToDaChoppa(); // Would return "We're outside"
  20. ( new Choppa )->getStatus(); // Would return "We're inside"
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
We're outsideWe're inside