How can I extend PHP functionality beyond functions & classes libraries?

You can't, and shouldn't. That isn't supported by the language. Even if you download the PHP source code and add your own custom operators/keywords, they aren't going to be magically available on other PHP installations.

Since you said the only reason you want to use PHP is because of it's popularity and availability, this kind of defeats the purpose.

An example about what I am trying to achieve is to be able to create my own operators, make language constructs myself (like foreach, while .. etc). You can't, and shouldn't. That isn't supported by the language.

Even if you download the PHP source code and add your own custom operators/keywords, they aren't going to be magically available on other PHP installations. Since you said the only reason you want to use PHP is because of it's popularity and availability, this kind of defeats the purpose. I was thinking of creating a tool to compile some custom language I make myself ... to valid PHP Compiling one scripting language into another scripting language is a bad idea.

You're going to be writing the most unportable code imaginable. ...but if I know how to do that I would better hack PHP core but I don't know much c or c++ (may be only how to make a tic, tac toe) If you don't know any compiled languages, you shouldn't even be considering writing a compiler for your PHP-drived language. If it's not possible from PHP itself ... what are the things/languages I need to learn to get to what I am trying to do?

C, obviously. Learn the language that PHP is developed in if you intend to change core functionality.

I already wrote a php script to parse a simple custom language I made implementing some ideas I had, and it worked! The problem is that when it comes to advanced language features using regular expressions can be so tedious task that doesn't worth the effort. I know there are parser generators and things like that but I am not able to find some decent book or tutorial about that.

About portability I think if the changes I make & ideas I implement were good that other coders would love to try, I think it will take few years and it will be available to the world, or php will just adopt them.! – Lettuce Oct 25 '10 at 1:48 @Lettuce Adding a compile step with a parser that makes heavy use of regular expressions is going to turn everybody away. If you think your ideas really are good, suggest them to the PHP team. – meagar Oct 25 '10 at 1:51 I am not able to try these ideas out to know if they are good, due to the limitations of the language that made the only chance to create a new functionality is to write functions or add classes.

– Lettuce Oct 25 '10 at 1:59 +1 for the "custom extensions defeat portability" point. – deceze Oct 25 '10 at 2:01.

What is the goal of trying to create an other language(custom), that no one know how to use. Go with PHP as is, and build extensions in C. Than you can propably name you internal extension function as you want.

The goal is to make the things that are not possible now to be possible. Imagine if PHP was all object oriented and datatypes were just objects! Imagine if all the functions with inconsistent naming conventions were just wrapped in classes/packages or whatever and let me choose whatever names I like for my functions and classes!

– Lettuce Oct 25 '10 at 1:57 1 @Lettuce Imagine using Ruby. Turning PHP into something not PHP is a pointless exercise. – meagar Oct 25 '10 at 1:59 Ruby is cool but PHP is so popular that customers who don't know how to use a mouse ask to get PHP sites!

– Lettuce Oct 25 '10 at 2:03 @Lettuce Then give them PHP sites, not sites in some language that compiles to working-but-unreadable PHP. – deceze Oct 25 '10 at 2:21.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions