How to convert code from C# to PHP [closed]

2019-01-12 01:07发布

I have a business logic classes that are written in pure C# (without any specific things from this language) and I would convert this code into PHP. I can write my own parser, but think if I could someone did it before me.

Could you please tell me where can I find this kind of converter?

Ps. As I've written I use only plain C# programming in this language. Only arguments, declarations of variables, equations and control statements.

5条回答
来,给爷笑一个
2楼-- · 2019-01-12 01:12

You can now run your PHP code on .NET calling into your business clases using phalanger.codeplex.com

查看更多
家丑人穷心不美
4楼-- · 2019-01-12 01:16

There is just started project cs2php. Sources are available on https://github.com/isukces/cs2php and homepage is http://www.cs2php.com/ .

查看更多
不美不萌又怎样
5楼-- · 2019-01-12 01:20

I know you're hoping for someone who had experience but in case no one comes forward...

You might consider just copy and pasting the code into a PHP script and checking what breaks. Write a parser to fix that, run it across the entire script, and see what's the next thing that breaks. Continue until the script functions as expected.

If you're not using any of the more involved .Net classes I can't imagine you'll have too much trouble.

查看更多
倾城 Initia
6楼-- · 2019-01-12 01:31

Are you asking for a tool to directly convert your C# code to PHP? I doubt there is one available and I'd be a little worried about using one (from what I've learnt of C# it's not easily transferrable to PHP).

Depending on the size of the project I'd be much more inclined to rewrite it. I did have a look but couldn't find anything (lots and lots of job requests though - looks like a business there =P).

查看更多
登录 后发表回答