Is require_once necessary inside the autoload function?

I was going over some examples I found, including some on this forum on how to use spl_autoload_register()

So it looks like inside the custom autoload functions people ofter use something like this:
function customLoader($class){
// some code to find file path based on $class, assign it to $file

if(file_exists($file){
include_once($file);
return true;

}

return false;

}

What I’m thinking is that why use include_once here instead of just include()

I think that since php only calls autoload when it knows that class is not already loaded, this basically already takes care of the “include_once” logic, which is “don’t include file if its already been included”

Then it would make sense to never use include_once() inside your custom autoload function since include_once is more expensive than include()

Does this make sense or am I missing some important point?

I think they use it out of habbit. I only ever use “include” in my autoloader and let spl_autoload handle the failure when the class is not found.

Thank what I thought, I mean autoload is called only when class in not already loaded, making include_once redundant and I’ve heard that include_once is really expensive function comparing to just include