Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

brakkar's avatar

Php includes and namespace and use statements

Hello, let's say I have a script A with its own namespace and use statements on top. Now in the middle of it, I include a script B with its own namespace and uses statements.

it works fine, yet PHP doesn't like to have includes and uses statements that are not on top of the script, which should be the case on the location of the included script. Behind the scene how does php treat such included scripts ?

0 likes
0 replies

Please or to participate in this conversation.