So, if you try to do a nested class like this:
//nestedtest.php
class nestedTest{
function test(){
class E extends Exception{}
throw new E;
}
}
You will get an error Fatal error: Class declarations may not be nested in [...]
but if you have a class in a separate file like so:
//nestedtest2.php
class nestedTest2{
function test(){
include('e.php');
throw new E;
}
}
//e.php
class E Extends Exception{}
So, why does the second hacky way of doing it work, but the non-hacky way of doing it does not work?