Code Parser

php.internals

vikas agrawal

21 years ago
Can some body tell me about the php parser which will first parse the programmer's code before uploading to the server? so that php interpreter will interpret stream lined code/understandable/indentable code for performance. Please reply. Vikas __________________________________ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com

Derick Rethans

21 years ago
On Mon, 10 Jan 2005, vikas agrawal wrote:
> Can some body tell me about the php parser which will > first parse the programmer's code before uploading to > the server? so that php interpreter will interpret > stream lined code/understandable/indentable code for > performance.
What do you want to know about it? Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Lukas Smith

21 years ago
Derick Rethans wrote:
> On Mon, 10 Jan 2005, vikas agrawal wrote: > > >>Can some body tell me about the php parser which will >>first parse the programmer's code before uploading to >>the server? so that php interpreter will interpret >>stream lined code/understandable/indentable code for >>performance. > > > What do you want to know about it?
If you want to check for security related things you may want to have a look at: http://bluga.net/projects/PHPCodeAnalyzer/ However your question sounds more related to using PHP and developing PHP. However this list is focused on the development of PHP. Therefore php-general seems like the more appropriate list to ask your question. regards, Lukas

Leonardo Pedretti

21 years ago
Are there any plans to include type hinting with basic types and type hinting for variables? (such as optional declaration) It would be useful to declare the type of a data member of a class, for example, for automation of data fetching from SQL databases or such things. Regards
-- Leonardo Pedretti Axon Sistemas Líder de Equipo Proyecto Basalto

Derick Rethans

21 years ago
On Mon, 10 Jan 2005, Leonardo Pedretti wrote:
> Are there any plans to include type hinting with basic types and type hinting > for variables? (such as optional declaration)
There are no such things planned, except for "array" afaik.
> It would be useful to declare the type of a data member of a class, for > example, for automation of data fetching from SQL databases or such things.
That is *definitely* not on the list - PHP is weakly typed and will remain so. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Leonardo Pedretti

21 years ago
On Monday 10 January 2005 17:58, Derick Rethans wrote:
> On Mon, 10 Jan 2005, Leonardo Pedretti wrote: > > Are there any plans to include type hinting with basic types and type > > hinting for variables? (such as optional declaration) > > There are no such things planned, except for "array" afaik.
That is quite good already, but...
> > It would be useful to declare the type of a data member of a class, for > > example, for automation of data fetching from SQL databases or such > > things. > > That is *definitely* not on the list - PHP is weakly typed and will > remain so.
I can't understand why being able to point some variable as strongly typed and remaining the default as weak typed would make php strongly typed. In fact, that assumption IS incorrect, a language is weakly typed when variable types are not forced to be respected though they already exist and change dynamically, and the programmer actively having to point a variable as strongly typed for the scope of a function obviously does not contradict that postulate. Even more, just having that feature in object data members would be heaven. Basic type hinting can be emulated using is_int, is_string, and so on on the beginning of the function needing that, but for objects it can not be done to know the type of a data member previously to it's assignment, and having to assign a value in the constructor forces one to declare a specific constructor doing that for classes that derive or implement an interface that has functions using that type for automation of tasks. Code just would be really so cleaner just by allowing one to put a type in front of an object data member declaration and allowing to retrieve that type. For example, consider this code: abstract class base { function __construct() { // constructor just sets up some things } function someoperation() { /* this function needs to load the data members of basic types with some clear values but everything that is an object or an array must be filled through some specific process that can be automated just knowing the specific type in advance */ } } class specific_class { function construct() { $var1 = new SomeClass; $var2 = new SomeOtherClass; } private $var1; private $var2; } would the types could be showed int the class, function someoperation could still perform its task without any change, but specific_class now would be just the following: class specific_class { private SomeClass $var1; private SomeOtherClass $var2; } Which is identical to the upper version. Moreover, specifying the constructor parameters in the declaration should not be a problem, as it is equivalent code to the upper version. Well, i hope all this can be useful! Regards Leo
> > Derick > > -- > Derick Rethans > http://derickrethans.nl | http://ez.no | http://xdebug.org
-- Leonardo Pedretti Axon Sistemas Líder de Equipo Proyecto Basalto

Andi Gutmans

21 years ago
I just want to add that phpDoc does support adding basic data types by using comments which can help you auto-generate code/sql statements. Andi At 09:58 PM 1/10/2005 +0100, Derick Rethans wrote:

Marek Kilimajer

21 years ago
vikas agrawal wrote:
> Can some body tell me about the php parser which will > first parse the programmer's code before uploading to > the server? so that php interpreter will interpret > stream lined code/understandable/indentable code for > performance. > > Please reply. > Vikas
You can use tokenizer: http://sk.php.net/manual/en/ref.tokenizer.php