- var_dump: documentation ( source)
<?php
class FooNoMoreException extends Exception {}
class Foo {
protected $count = 500;
public function step() {
if (!$this->count) {
throw new FooNoMoreException('No more steps to take.');
}
$this->count--;
}
}
$f = new Foo;
try {
while ($f->step() || true) {}
} catch (FooNoMoreException $e) {}
var_dump($f);