views:

77

answers:

4

Hi,

I am wondering if there are any languages that extend PHP into something ahem "better"?

They don't have to necessarily be able to interact with PHP, but it is certainly a benefit if they can (e.g. call PHP functions or even be called from PHP).

+2  A: 

One example:

The LOL Code PHP Parser: http://www.tetraboy.com/lolcode/

Graphain
Interesting definition of "better". :3 ...oh, wait, you used quotes around it already.
Faisal
@Faisal haha, yeah it's not what I'm looking for but it's a proof of concept
Graphain
Did you look at the LOLcode? `ALWAYZ SKY IZ BLUE` is seriously how to declare a constant. I'm afraid I couldn't write in it without laughing myself silly.
amphetamachine
@amphetamachine LOLCode is definitely hilarious. I'm not saying LOLCode is better, just that it shows you can write other languages in PHP (obviously). I'm just looking to see if there are any good ones.
Graphain
It looks to even have a LOLCode syntax SQL
Graphain
A: 

Here's an article from CodingHorror about Wasabi, a language which apparently compiles down to PHP among other strange things:

http://www.codinghorror.com/blog/2006/09/has-joel-spolsky-jumped-the-shark.html

If you mean extending PHP's capabilities, I assume the plentiful modules that exist for it already do that...

Faisal
Wasabi is a great example. I don't mean extending, I'm talking type-safety etc.
Graphain
That CodingHorror article is very, very poor. The author lost any shred of credibility when he couldn't tell Ruby and Ruby on Rails apart.
erjiang
Apologies, I only meant to show that the language existed rather than to promote the article itself.
Faisal
@mazin k. - true but Wasabi itself is relevant (if not available for use).
Graphain
+2  A: 

There's Facebook Hip Hop. It takes PHP, compiles it down to C++, and then compiles that into a big fat binary with a webserver included. Then you just deploy that. It ends up being a big file - weighing in at 1 GB - but it reduces server load by upwards of 50%.

We have some discussion on php|architect - http://www.phparch.com/?s=hiphop

CaseySoftware
I think the asker is looking for the other way around, with PHP as the compile target (like Clojure on Java).
erjiang
@mazin k. exactly, but this is still cool. I just want to be writing something other than PHP that works in a PHP server environment
Graphain
A: 

FogBugz is written in a custom in-house extension of VBScript that they can compile to either VBScript or PHP (for Windows and Unix servers, respectively). Their compiler is written in C#.

http://www.joelonsoftware.com/items/2006/09/01b.html is a good read.

erjiang
I read the article, and I have to admit that I'm not convinced that writing a compiler that emits VBScript/PHP/Javascript/etc. makes much sense. What do you gain, exactly? It sounds like a shoddy solution for homogenizing multiple target languages and thus ignoring their strengths and weaknesses, not to mention making it practically impossible for the compiled code to be reused/extended. Contrast this to languages that target virtual machines like .NET, which by their nature encourage bytecode-level interoperability.
Faisal
In general, creating new languages with no heed for standards or interoperability is fine (and in some cases preferable) if you're running a closed shop, but it makes things agonizing when you start to include people who aren't familiar with your assumptions.
Faisal
On second thought, if it makes it easier for them to program (e.g. by adding nice language features to languages that otherwise lack them), I suppose I don't see it as a problem.
Faisal