Skip to content

Instantly share code, notes, and snippets.

@mncaudill
Created December 21, 2010 09:03
Show Gist options
  • Save mncaudill/749686 to your computer and use it in GitHub Desktop.
Save mncaudill/749686 to your computer and use it in GitHub Desktop.
BigQuine: PHP->C->Python->JS->original PHP program
#!/bin/bash
php php-c-python-js-php-quine.php > quine.c
gcc -Wall -o quinec quine.c
./quinec > quine.py
python quine.py > quine.js
node quine.js > quine.php
diff php-c-python-js-php-quine.php quine.php
<?php
$php="112,114,105,110,116,32,34,35,105,110,99,108,117,100,101,32,60,115,116,100,105,111,46,104,62,92,110,92,110,105,110,116,32,109,97,105,110,40,41,123,112,114,105,110,116,102,40,92,34,112,114,105,110,116,32,92,92,92,34,112,104,112,61,91,36,112,104,112,93,59,115,116,114,105,110,103,61,39,39,59,99,111,110,115,111,108,101,46,108,111,103,40,39,60,63,112,104,112,39,41,59,99,111,110,115,111,108,101,46,108,111,103,40,39,39,41,59,102,111,114,40,105,61,48,59,105,60,112,104,112,46,108,101,110,103,116,104,59,105,43,43,41,123,115,116,114,105,110,103,43,61,112,104,112,91,105,93,43,39,44,39,59,125,99,111,110,115,111,108,101,46,108,111,103,40,39,92,36,112,104,112,61,92,92,92,92,92,92,92,34,39,43,115,116,114,105,110,103,43,39,92,92,92,92,92,92,92,34,59,39,41,59,99,111,110,115,111,108,101,46,108,111,103,40,39,39,41,59,115,116,114,105,110,103,61,39,39,59,102,111,114,40,105,61,48,59,105,60,112,104,112,46,108,101,110,103,116,104,59,105,43,43,41,123,115,116,114,105,110,103,43,61,83,116,114,105,110,103,46,102,114,111,109,67,104,97,114,67,111,100,101,40,112,104,112,91,105,93,41,59,125,99,111,110,115,111,108,101,46,108,111,103,40,115,116,114,105,110,103,41,59,92,92,92,34,92,34,41,59,114,101,116,117,114,110,32,48,59,125,34,59,";
print "#include <stdio.h>\n\nint main(){printf(\"print \\\"php=[$php];string='';console.log('<?php');console.log('');for(i=0;i<php.length;i++){string+=php[i]+',';}console.log('\$php=\\\\\\\"'+string+'\\\\\\\";');console.log('');string='';for(i=0;i<php.length;i++){string+=String.fromCharCode(php[i]);}console.log(string);\\\"\");return 0;}";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment