Skip to content

Instantly share code, notes, and snippets.

@nitrix
Created June 14, 2012 19:51
Show Gist options
  • Save nitrix/2932523 to your computer and use it in GitHub Desktop.
Save nitrix/2932523 to your computer and use it in GitHub Desktop.
PHP challenge
<?php
$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 \"<?php\\n\";
echo '\$y = \"' . q(\$y) . '\";';
echo \"\\n\\neval(\";
echo '\$y);';
echo \"\\n?>\\n\";
";
eval($y);
?>
@nitrix
Copy link
Author

nitrix commented Jun 14, 2012

My attempt at a PHP quine after seeing one by Trevor Sayre:
<?php printf($a='<?php printf($a=%c%s%c,39,$a,39);',39,$a,39);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment