2 scenarios:
if($action=="view") {
view($id);
} elseif($action=="edit") {
edit($id);
}
function show($id) {
echo "blah";
}
function edit($id) {
echo "blah";
}
or this:
if($action=="view") {
echo "blah";
} elseif($action=="edit") {
echo "blah";
}
considering there were 50 actions that all had a lot of code (1000 lines lets say) what exactlly does PHP do? I normally code in the first style, but someone brought up that PHP has to 'load' all of those functions and that is wasteful. i have never had any performance issues... so it really doesn't matter, but what exactlly is going on?
they said that in truely scripted languages the interpreter would just ignore everything after the initial if was true, and it wouldn't have to load anything else... and therefore the second style is better. I guess i just figured that the PHP developers made the system the most intelligent way possible.