tags:

views:

389

answers:

12

Sorry if this is a silly and/or stupid question but... Will there ever be, or would it even be possible to have a PHP.NET? Or have I got the wrong end of the stick?

It seemed to me that one of the main points of .NET was that you could write your code in one of a bunch of the .NET languages and have it compile into CLR. Could this happen with PHP, or is there something about PHP that makes this impossible? Or is there more political reasons? Or is it just a retarded idea?

+1  A: 

Once this is in I don't see why not.

http://en.wikipedia.org/wiki/Dynamic_Language_Runtime

ChaosPandion
+3  A: 

I would say that it is unlikely as that there is ASP.net, but I would not say never because of Python.NET or IronPython. There is already one attempt called Phalanger. From the looks of the official wiki, its a serious development effort.

monksy
+4  A: 

Someone has actually already begun working on just such a thing

http://www.codeplex.com/Phalanger

http://www.php-compiler.net/doku.php

Darrell Brogdon
+1  A: 

The CLR is essentially a virtual machine, so things are compiled to it essentially the same way C code is compiled to x86 or PowerPC or arm or whatever.

There is an implementation of python that compiles to .NET assemblies, there's also COBOL, and a few others. No technical reason PHP couldn't be done the same and executed by the CLR in IIS.

whatsisname
Compilation is the trivial part; porting the huge library of builting PHP functions using god knows what kind of dirty C tricks is a rather different matter...
Michael Borgwardt
A: 

.NET is a framework that is based on a number of technologies such as CLR and provides an extensive collection well-organized class libraries that are suitable for almost all conceivable functions that are used in Web applications. In addition, it allows you to easily create components that extend the framework.

Although PHP has similar properties, such as PEAR libraries, PHP and ASP.NET are not really identical, because the .NET framework ab ovo on an OOP paradigm and OOP-based approaches, and PHP is not. This difference is most evident in the way, is how to access classes and objects in PHP and ASP.NET.

streetparade
+2  A: 

Sure, there's a possibility. Python runs in the CLR, after all.

Side note: PHP is now a one-click install for IIS, so if you're waiting to bring PHP into your Microsoft stack, go ahead and give it a try. MS is even working on a PHP bytecode cache for Windows.

mmsmatt
+5  A: 

As an aside:

I don't believe .Net support for PHP would be a great idea.

I use PHP every day of my life. It's not because I like the language (it's a collection of mismatched functions with very little OO support), but rather because it's the best tool for the job.

PHP has a lightweight feel and one can do almost anything in a few easy lines. It's string handling is effortless, and support is ubiquitous. Array handling is great, too.

I feel that if PHP joined the .Net CLR I would not be tempted to switch over to use it. If one wanted to work with .Net one would do better to use a nicer, better structured language, such as C#.

Antony Carthy
I'm not really sure what you're saying here. That you don't think it would be a great idea because you wouldn't be tempted to switch over? As for it being lightweight, the .NET has the forthcoming DLR which wouldn't impose any heavy burdens on the language like running in the regular CLR would.
jasonh
I think that the PHP is not a well structured language and wouldn't add anything to the .Net framework. PHP is more of a vast set of useful functions, the .Net class libraries will already provide most of this. So PHP .Net will essentially be a poor OO implementation with some bad syntax... and no additional benefits. Of course PHP is my web language of choice, but I argue that it doesn't suit .Net.
Antony Carthy
A: 

You could give a try to the jsc project which will convert MSIL to php source for you.

This will enable you to write C# code in visual studio and run it on an inexpensive php server.

alt text

zproxy
A: 

The two are totally different, they are in competition with each other. Both will try to be good at their ends. So i dont think there is going to be anything as such in the future. However, you can use PHP inside of Visual Studio, there are plugins available for that.

Thanks

Sarfraz
A: 

PHP have got suspiciously pally with Windows... it doesn't seem impossible

And besides PHP.NET

Gausie
A: 

Well PHP is good as is already. Even if it does become PHP.NET I doubt it will be done by Microsoft.

Nick Brooks
A: 

you could develop php on windows to use windows functions, and ultimately call on .NET objects. I believe apache now allows php to call on native windows calls/functions and .NET functions/classes/objects, provided you have the right settings turned on.

as for .NET adapting php syntax, i think some people are trying to do this, aside from the existing attempts.

trace