Skip to content

Instantly share code, notes, and snippets.

@bobmagicii
Created December 11, 2015 20:19
Show Gist options
  • Save bobmagicii/2df74b6d1afa42e7b525 to your computer and use it in GitHub Desktop.
Save bobmagicii/2df74b6d1afa42e7b525 to your computer and use it in GitHub Desktop.
<?php
class Whatevs {
public function
__ToString() {
/*//
try to generate the string we need, else show a fallback.
//*/
try {
$Output = $this->FailHard();
}
catch(Exception $Error) {
$Output = 'It Failed Hard.';
}
return $Output;
}
protected function
FailHard() {
throw new Exception('diaf');
}
}
class Wonky
extends Whatevs {
}
$Whatevs = new Wonky;
echo $Whatevs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment