11 comments

[ 2.7 ms ] story [ 38.7 ms ] thread
nice work!!!!
Serious question: Who is this for?
I was wondering the same thing..
Depends if you mean this tool or the compiler in general. I'd recommend distancing yourself from your possible prejudices against either language, taking a step back and looking at it objectively. You won't be able to argue against the fact that a massive chunk of the internet is written in PHP. You'd also be hard pressed to disagree that .NET is an architecturally superior and highly robust language with a very good tooling and service ecosystem. You can make the connection.
I'm not being prejudiced. I have a genuine professional curiosity regarding the use cases for this. Somebody clearly spent a lot of time and effort making this, generally people don't do that sort of thing without a good reason. The fact that I cannot fathom a reason for this makes me think there is room for self education. It's good to take that approach is all aspects of life I think.
Not disagreeing with you. Somebody posted the usecases below (https:/www.peachpie.io/usecases). The most common usecase is basically a legacy site in PHP that wants to/has to migrate to .NET. Reasons can include connecting PHP to .NET modules, performance enhancements, security issues that .NET doesn't have to worry about. There are other possible usecases though, like producing/consuming NuGets from PHP codes, distributing PHP apps sourcelessly, being able to run PHP apps on any platform or OS, extending massive PHP frameworks with C# modules, for instance. And then some funky exotic ones like crating games/apps/IoT software in PHP.

For most people (not saying it's your case) it's just a matter of not being that close minded and understanding that different companies or devs might have different language preferences. Or just to look outside their current box of thinking and see that any of the above might be useful for someone.

The generated C# code is so weird and completely incomprehensible. I've never seen anything like that.

The practical use case also seems non-existent. How can you possibly translate all sorts of functions that .NET doesn't even have?

To be fair, it is decompiled code you are looking at. If you open the dropdown you will find the optgroup with the label that says "Decompiled".
they re-implemented all functions in .net. The code is decompiled from bytecode thats why its incomprehensible and hence the title PHP to .NET and not PHP to C#.
Like someone below already answered, it's actually compiled to MSIL and what you're looking at is decompiled C#. All PHP functions have been reimplemented in .NET.