views:

2603

answers:

4

Hello,

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.

A: 

Find a Replace

Seriously, if it's that's simple... this might be all you need.

Allain Lalonde
Yes, but how? I have like > 10 000 LOC. Find and replace like regex yes? Maybe there is someone who have written regex's once and can share?
tomaszs
+2  A: 

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).

Ross
I use only basic things like as I have written. I new before writing in C# that some day I will need to translate the code to other languages too.
tomaszs
+2  A: 

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.

Spencer Ruport
see my anwser below
zproxy
+2  A: 

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
zproxy