- Output for 7.3.0, 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
- string(11) "Outside Foo" string(10) "Foo In Try" string(12) "Foo in Class"
<?php
class Foo {
private $foo_in_class;
public function do_foo() {
$outside_foo = null;
try {
$outside_foo = 'Outside Foo';
$foo_in_try = 'Foo In Try';
$this->foo_in_class = 'Foo in Class';
throw new Exception();
} catch (Exception $e) {
var_dump($outside_foo);
var_dump($foo_in_try);
var_dump($this->foo_in_class);
}
}
}
(new Foo)->do_foo();