usually when we write include, we mean that in the place where they wrote there and the code from the file is inserted

what happens with __autoload ? where does he insert the files?

and if to use?

 spl_autoload_register('autoload'); 

ADDITION:

Now let's say the class is called new User()

well, let's say autoload prisabachil file before this call, but then suppose in another class again called new User() admissible even in a different scope, and that autoload re-attaches file?

it is not effective if so

SUPPLEMENT 2:

But let's say the call spl_autoload_register() is in one class and the function itself in another

Where then the file will be included?

In the place where the function spl_autoload_register() is called or in the function itself where is the inclus registered?

    1 answer 1

    spl_autoload_register () has as its argument a function in which it is written include or include_once (in fact, anything, so long as the class appears after that), when calling new User (); This is the function that will be called in the place where it has the include() line and your include will be there.

    Next, read the manual on include to understand what is actually happening. (hint - classes are globally declared, or in the namespace)

    • Finished up addition 2 - dfhsfhgfj
    • The launch of the inclus will take place in the callback function, how it works - read the documentation. (another hint - php is usually single track) - zb '
    • In general, you think about how this may be different in this case from the usual include - answer - nothing. But the function may not include, there may be for example eval, or include and eval, or some other way to create a class. - zb '