- array_map: documentation ( source)
- explode: documentation ( source)
<?php
array_map(function ($i) {
eval("class {$i}Exception extends Exception { }");
}, explode(' ', 'Foo Bar'));
try {
throw new FooException('foo');
} catch (FooException $e) {
throw new BarException('bar');
} catch (BarException $e) {
echo 'hallo!';
}