Recently I rewrote a very small PHP program (~300 lines) under the GNU General Public License into an equivalent C# program and it made me curious where the new program I wrote stands legally. Is the C# code I have written still under the GNU General Public License since it was converted from the PHP program?

The new code I have written is a direct - almost line by line - translation of the PHP program into C#. After the translation I added a few additional features to it I needed that were not in the original PHP version.

To be perfectly clear, this is mostly asked out of simple curiosity. Regardless of the answer, I am at the very least planning on giving credit to the author of the PHP program and providing a link back to his code.

  • 2
    If you copy a program by translating line by line or nearly line by line, then that is going to be considered a derivative work of the original (unless if all lines that were copied are non-protectable elements for copyright protection; possible for such a small program), so in general you need to abide by the original license (GPL). You can probably find more information about this on the Open Source StackExchange. By the way, the GPL requires certain notices be retained but it does not require that you provide a "link back to his code."
    – Brandin
    Apr 26, 2018 at 14:31

1 Answer 1


I actually found the answer to this after asking by looking at this question, which led me to the gpl faq. In case the link dies, it says:

What does the GPL say about translating some code to a different programming language?

Under copyright law, translation of a work is considered a kind of modification. Therefore, what the GPL says about modified versions applies also to translated versions.

Therefore, the code I wrote is considered to be a modified version of the PHP code I found and must be released under the GPL license.

  • You can NOT copyright ideas, only a fixed medium. Applying that translation is a derived work to code would be borderline in my opinion, it's really meant for literature. By reimplementing the package into another language, you have at most copied an idea or concept. See softwareengineering.stackexchange.com/questions/216471/… for more information.
    – GB - AE7OO
    Oct 4, 2019 at 18:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .