tags:

views:

51

answers:

1

I've been studying Visibility issue in PHP (public, private, protected) and wondered how is this sort of "dom-building" is implemented in PHP? I mean there should be some kind of algorithm that PHP uses to go through all your classes and establish relations between them. Not sure if it is called "dom-building" though, but I think the same algorithms are utilized by the modern IDE's that may use it for auto-completion.

Can someone redirect me to a nice resource? Thank you.

+1  A: 

PHP does not pass through all your classes and establish relations between them. Only at run-time, when you call a method on another class, PHP checks whether that method is accessible (i.e. public or in some cases protected).

Sjoerd
Is it that simple? Ok. But PHP has to parse your code before it can "check" accessiblity. So, the way I see it: parsing should result in some sort of DOM object..? Or this isn't how it works?
Dziamid
Parsing results in a *parse tree* or *syntax tree*. This tree is then compiled to *opcodes*. These opcodes are like assembly for PHP. The PHP interpreter executes these opcodes.
Sjoerd
Can you direct me to a resource where this is described?
Dziamid