Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 488
Tom Smykowski Avatar asked Jan 13 '09 22:01

Tom Smykowski


2 Answers

The jsc project can convert .net/C# to PHP for you.

  1. Overview: http://jsc.sf.net
  2. Source: http://jsc.sourceforge.net/examples/web/OrcasAvalonWebApplication/
  3. Example: http://jsc.svn.sourceforge.net/viewvc/jsc/templates/OrcasAvalonWebApplication/ alt text
like image 127
zproxy Avatar answered Sep 30 '22 13:09

zproxy


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.

like image 20
Spencer Ruport Avatar answered Sep 30 '22 14:09

Spencer Ruport