Skip to content

Instantly share code, notes, and snippets.

@ha1t
Created April 26, 2012 01:07
Show Gist options
  • Save ha1t/2494961 to your computer and use it in GitHub Desktop.
Save ha1t/2494961 to your computer and use it in GitHub Desktop.
nameの文字列がaを何回インクリメントすると表現できるかしらべるものっぽい
<?php
/**
* nameの文字列がaを何回インクリメントすると表現できるかしらべるものっぽい
*/
ini_set('max_execution_time', 5);
if ( !isset($_POST['name']) ) {
$str = <<<EOD
<form method="post">
name<input type="text" name="name" />
<input type="submit" />
</form>
EOD;
print($str);
} else {
$a = 'a';
$i = -1;
while($a != $_POST['name']){
$i++;
$a++;
}
print('<hr>');
print('php -r' . '\'$a="a"; for($i=0;$i<=' . $i .';$i++)'.'{$a++;}' . ' print "$a\n";\'');
print('<hr>');
}
@ha1t
Copy link
Author

ha1t commented Apr 26, 2012

昔書いたコードはこのようにファイル名も適当でコメントもないし何がしたいのかぜーんぜんわからないひどいものが多いですね:shit:

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