PHP Quine¶
<?php
$code = '<?php
$code = %c%s%c;
printf($code, 39, $code, 39);';
printf($code, 39, $code, 39);
A quine is a piece of code that produces itself. It takes not input, and outputs a text that is its own code. The code is run to produce itself.
One may consider a file without PHP tags as a Quine: PHP executes such code by outputting the raw text. It is considered valid, yet too easy to be a quine.
See Also¶
Quine in PHP [Try me]
PHP Features¶
Last updated: 14 July 2026