I don't know if you are wrong; I can only speak from my memory and experience. I could well be wrong myself.
My understanding was that once a class is loaded via require/include to the opcode cache, it remains available on subsequent runs. That the require/include occurs within an if() is of little or no consequence to the opcode cache. E.g., this is not a problem ...
if ($condition) {
include "/path/to/file.php";
}
... because the bytecode cache retains in memory the opcodes for that file, and has in-memory access to it on subsequent runs when the condition is met. It won't need to load from the filesystem every time, just the first time the file needed.
AFAIK this is not (totally) the case.. Autoload is very convenient, but
generally should only be used as a fallback. I think generally opcode
caches still work, but are 'less effective'. I'm not totally sure what
the exact definition of this is.
The reason is that 'include's' which are not conditional are handled by
PHP at 'parse time' and conditional includes at run-time.. I remember
this because I sent a bug report on it ages ago
(http://pecl.php.net/bugs/bug.php?id=5314).
I can't really give you hard facts or proper sources, but I just
remember reading at multiple spots that its better to not have any
conditional includes. This also includes stuff like:
include dirname(__FILE__) . '/filename';
As this is also considered conditional..
Evert