Skip to content

Instantly share code, notes, and snippets.

@purplejacket
Created February 15, 2011 23:12
Show Gist options
  • Save purplejacket/828485 to your computer and use it in GitHub Desktop.
Save purplejacket/828485 to your computer and use it in GitHub Desktop.
A quine in PHP language
<?
# PHP Quine written by Ian Kjos - [email protected]
$y = "function q(\$q) {
\$q = str_replace('\\\\', '\\\\\\\\', \$q);
\$q = str_replace('\$', '\\\\\$', \$q);
\$q = str_replace('\\n', '\\\\n', \$q);
\$q = str_replace('\"', '\\\\\"', \$q);
return \$q;
}
echo \"<?\\n\\n\";
echo \"# PHP Quine written by Ian Kjos - [email protected] \\n\\n\";
echo '\$y = \"' . q(\$y) . '\";';
echo \"\\n\\neval(\";
echo '\$y);';
echo \"\\n\\n\\n\";
";
eval($y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment