📜 ⬆️ ⬇️

A little brain warm-up (or quine on php)

I checked here on some site an interesting puzzle, namely:

Write a php script that would output its own code.
Conditions:
- Use the functions of reading the file and the stream can not.
- The code should be output from and to, including the characters <? Php ...?>
- The code should be as short as possible.

Honestly, at first I fell into a stupor, but after half an hour I came to this result
(remove line breaks, put so that the banner does not run).
')
<?$a='<?$a="%s";printf(str_replace(chr(34),chr(39),$a),$a);?>';
printf(str_replace(chr(34),chr(39),$a),$a);?>



But something tells me that this is far from the only solution. So the community opinion is just interesting - can anyone offer more solutions? Including all sorts of hacks, (halt_compiler different), etc.

Source: https://habr.com/ru/post/54631/


All Articles