The php.net web site is full of comments showing code snippets/functions/small libraries. I was unable to find any mention on php.net regarding what license these snippets fall under, and a web search didn't show me anything.

Does anyone know what the legal rules are for reusing these pieces of code?

Is it enough to include a comment specifying where the code came from?

Should the code never be reused without contacting the original comment author?

Does the PHP web site enforce a particular copyright license (such as MIT, BSD, or GPL) for users contributed comments?

If php.net is considered a public meeting place for user posted content, then I imagine each poster owns the copyright to their respective code, and therefore the code can't ever be reused without contacting the original author and obtaining a copyright license (often not possible, due to fake or old/expired e-mails being used)... which would make the whole point of the easily accessible code snippets moot, as you can't use them.

Is it legally allowed to write new code based on the code snippets, without directly copying and pasting their code, i.e. using different formatting, different variable names, not identical code structure, etc.?

3 Replies 3

PHP.net manual text and the user-submitted comments/code snippets are licensed under Creative Commons Attribution 3.0 (CC-BY 3.0).

You may reuse the code (even commercially), but you must provide proper attribution to the PHP Documentation Group or link back to the original source.

https://www.php.net/manual/add-note.php:

Please note that periodically the developers go through the notes and may incorporate information from them into the documentation. This means that any note submitted here becomes the property of the PHP Documentation Group and will be available under the same license as the documentation.

And what "same license" links to, says:

The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License, copyright (c) the PHP Documentation Group

Thank you kindly, Manoj Kumar Josh and C3roe.

I had located that license page when web searching, but without the note at the bottom of the other page, I didn't know it applied to user-submitted comments as well. It would be handy if the PHP license page directly mentioned user comments.

Cheers.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.