summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html')
-rw-r--r--vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html435
1 files changed, 232 insertions, 203 deletions
diff --git a/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html b/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html
index b4875558..3469e8b1 100644
--- a/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html
+++ b/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html
@@ -14,8 +14,7 @@
<meta property="og:locale" content="ja_JP">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<title>PHPerKaigi 2022 トークン問題の解説|REPL: Rest-Eat-Program Loop</title>
- <link rel="stylesheet" href="/style.css?h=79020a898c7052f79b32e90376a4497d">
- <link rel="stylesheet" href="/hl.css?h=340e65ffd5c17713efc9107c06304f7b">
+ <link rel="stylesheet" href="/style.css?h=60eb349e583f5bd51518a7eb98598043">
</head>
<body class="single">
<header class="header">
@@ -84,75 +83,77 @@
ソースコードはこちら。実行には PHP 8.1 以上が必要なので注意。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-meta">&lt;?php</span>
-
-<span class="hljs-keyword">declare</span>(strict_types=<span class="hljs-number">0O1</span>);
-
-<span class="hljs-keyword">namespace</span> <span class="hljs-title class_">Dgcircus</span>\<span class="hljs-title class_">PHPerKaigi</span>\<span class="hljs-title class_">Y2022</span>;
-
-<span class="hljs-comment">/**
- * <span class="hljs-doctag">@todo</span>
- * Run this program to acquire a PHPer token.
- */</span>
-
-https:<span class="hljs-comment">//creativecommons.org/publicdomain/zero/1.0/</span>
-
-\<span class="hljs-title function_ invoke__">error_reporting</span>(~+!<span class="hljs-string">&#x27;We are hiring!&#x27;</span>);
-
-<span class="hljs-variable">$z</span> = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$f</span></span>) =&gt;</span> (<span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$x</span></span>) =&gt;</span> <span class="hljs-variable">$f</span>(<span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params">...<span class="hljs-variable">$xs</span></span>) =&gt;</span> <span class="hljs-variable">$x</span>(<span class="hljs-variable">$x</span>)(...<span class="hljs-variable">$xs</span>)))(<span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$x</span></span>) =&gt;</span> <span class="hljs-variable">$f</span>(<span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params">...<span class="hljs-variable">$xs</span></span>) =&gt;</span> <span class="hljs-variable">$x</span>(<span class="hljs-variable">$x</span>)(...<span class="hljs-variable">$xs</span>)));
-<span class="hljs-variable">$id</span> = \<span class="hljs-title function_ invoke__">spl_object_id</span>(...);
-<span class="hljs-variable">$put</span> = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$c</span></span>) =&gt;</span> \<span class="hljs-title function_ invoke__">printf</span>(<span class="hljs-string">&#x27;%c&#x27;</span>, <span class="hljs-variable">$c</span>);
-<span class="hljs-variable">$mm</span> = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$p</span>, <span class="hljs-variable">$n</span></span>) =&gt;</span> <span class="hljs-keyword">new</span> <span class="hljs-title class_">\ArrayObject</span>(\<span class="hljs-title function_ invoke__">array_fill</span>(+!![], <span class="hljs-variable">$n</span>, <span class="hljs-variable">$p</span>));
-
-$👉 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span> [++<span class="hljs-variable">$mp</span>, ++<span class="hljs-variable">$pc</span>];
-$👈 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span> [--<span class="hljs-variable">$mp</span>, ++<span class="hljs-variable">$pc</span>];
-$👍 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span> [<span class="hljs-variable">$mp</span>, ++<span class="hljs-variable">$pc</span>, ++<span class="hljs-variable">$m</span>[<span class="hljs-variable">$mp</span>]];
-$👎 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span> [<span class="hljs-variable">$mp</span>, ++<span class="hljs-variable">$pc</span>, --<span class="hljs-variable">$m</span>[<span class="hljs-variable">$mp</span>]];
-$📝 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span> [<span class="hljs-variable">$mp</span>, ++<span class="hljs-variable">$pc</span>, <span class="hljs-variable">$put</span>(<span class="hljs-variable">$m</span>[<span class="hljs-variable">$mp</span>])];
-$🤡 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span> <span class="hljs-keyword">match</span> (<span class="hljs-variable">$m</span>[<span class="hljs-variable">$mp</span>]) {
- +!![] =&gt; [<span class="hljs-variable">$mp</span>, <span class="hljs-variable">$z</span>(<span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$loop</span></span>) =&gt;</span> <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$pc</span>, <span class="hljs-variable">$n</span></span>) =&gt;</span> <span class="hljs-keyword">match</span> (<span class="hljs-variable">$id</span>(<span class="hljs-variable">$p</span>[<span class="hljs-variable">$pc</span>])) {
- <span class="hljs-variable">$b</span> =&gt; <span class="hljs-variable">$loop</span>(++<span class="hljs-variable">$pc</span>, ++<span class="hljs-variable">$n</span>),
- <span class="hljs-variable">$e</span> =&gt; <span class="hljs-variable">$n</span> === +!![] ? ++<span class="hljs-variable">$pc</span> : <span class="hljs-variable">$loop</span>(++<span class="hljs-variable">$pc</span>, --<span class="hljs-variable">$n</span>),
- <span class="hljs-keyword">default</span> =&gt; <span class="hljs-variable">$loop</span>(++<span class="hljs-variable">$pc</span>, <span class="hljs-variable">$n</span>),
- })(<span class="hljs-variable">$pc</span>, -![])],
- <span class="hljs-keyword">default</span> =&gt; [<span class="hljs-variable">$mp</span>, ++<span class="hljs-variable">$pc</span>],
-};
-$🎪 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span> <span class="hljs-keyword">match</span> (<span class="hljs-variable">$m</span>[<span class="hljs-variable">$mp</span>]) {
- +!![] =&gt; [<span class="hljs-variable">$mp</span>, ++<span class="hljs-variable">$pc</span>],
- <span class="hljs-keyword">default</span> =&gt; [<span class="hljs-variable">$mp</span>, <span class="hljs-variable">$z</span>(<span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$loop</span></span>) =&gt;</span> <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$pc</span>, <span class="hljs-variable">$n</span></span>) =&gt;</span> <span class="hljs-keyword">match</span> (<span class="hljs-variable">$id</span>(<span class="hljs-variable">$p</span>[<span class="hljs-variable">$pc</span>])) {
- <span class="hljs-variable">$e</span> =&gt; <span class="hljs-variable">$loop</span>(--<span class="hljs-variable">$pc</span>, ++<span class="hljs-variable">$n</span>),
- <span class="hljs-variable">$b</span> =&gt; <span class="hljs-variable">$n</span> === +!![] ? <span class="hljs-variable">$pc</span>+![] : <span class="hljs-variable">$loop</span>(--<span class="hljs-variable">$pc</span>, --<span class="hljs-variable">$n</span>),
- <span class="hljs-keyword">default</span> =&gt; <span class="hljs-variable">$loop</span>(--<span class="hljs-variable">$pc</span>, <span class="hljs-variable">$n</span>),
- })(<span class="hljs-variable">$pc</span>, -![])],
-};
-$🐘 = <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$p</span></span>) =&gt;</span> <span class="hljs-variable">$z</span>(<span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$loop</span></span>) =&gt;</span> <span class="hljs-function"><span class="hljs-keyword">fn</span>(<span class="hljs-params"><span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span></span>) =&gt;</span>
- <span class="hljs-keyword">isset</span>(<span class="hljs-variable">$p</span>[<span class="hljs-variable">$pc</span>]) &amp;&amp; <span class="hljs-variable">$loop</span>(<span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, ...(<span class="hljs-variable">$p</span>[<span class="hljs-variable">$pc</span>](<span class="hljs-variable">$m</span>, <span class="hljs-variable">$p</span>, <span class="hljs-variable">$b</span>, <span class="hljs-variable">$e</span>, <span class="hljs-variable">$mp</span>, <span class="hljs-variable">$pc</span>)))
-)(<span class="hljs-variable">$mm</span>(+!![], +(![].![])), <span class="hljs-variable">$p</span>, <span class="hljs-variable">$id</span>($🤡), <span class="hljs-variable">$id</span>($🎪), +!![], +!![]);
-
-$🐘([
- $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍,
- $🤡,
- $👉, $👍, $👍, $👍,
- $👉, $👍, $👍, $👍, $👍, $👍,
- $👉, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍,
- $👉, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍,
- $👈, $👈, $👈, $👈, $👎,
- $🎪,
- $👉, $👍, $👍, $👍, $👍, $👍, $📝,
- $👎, $👎, $📝,
- $👉, $👎, $👎, $👎, $📝,
- $👉, $👎, $👎, $👎, $📝,
- $👎, $👎, $📝,
- $👎, $📝,
- $👈, $📝,
- $👉, $👉, $👎, $👎, $📝,
- $👍, $👍, $👍, $👍, $👍, $👍, $👍, $📝,
- $👈, $👎, $👎, $👎, $👎, $📝,
- $👈, $📝,
- $👉, $👍, $👍, $📝,
- $👉, $👎, $📝,
- $👈, $📝,
-]);</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">&#x3C;?</span><span style="color:#005CC5">php</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#D73A49">declare</span><span style="color:#24292E">(</span><span style="color:#005CC5">strict_types</span><span style="color:#D73A49">=</span><span style="color:#005CC5">0O1</span><span style="color:#24292E">);</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#D73A49">namespace</span><span style="color:#6F42C1"> Dgcircus\PHPerKaigi\Y2022</span><span style="color:#24292E">;</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#6A737D">/**</span></span>
+<span class="line"><span style="color:#6A737D"> * </span><span style="color:#D73A49">@todo</span></span>
+<span class="line"><span style="color:#6A737D"> * Run this program to acquire a PHPer token.</span></span>
+<span class="line"><span style="color:#6A737D"> */</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#005CC5">https</span><span style="color:#D73A49">:</span><span style="color:#6A737D">//creativecommons.org/publicdomain/zero/1.0/</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#005CC5">\error_reporting</span><span style="color:#24292E">(</span><span style="color:#D73A49">~+!</span><span style="color:#032F62">'We are hiring!'</span><span style="color:#24292E">);</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$z </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($f) => (</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($x) => $f(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">(</span><span style="color:#D73A49">...</span><span style="color:#24292E">$xs) => $x($x)(</span><span style="color:#D73A49">...</span><span style="color:#24292E">$xs)))(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($x) => $f(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">(</span><span style="color:#D73A49">...</span><span style="color:#24292E">$xs) => $x($x)(</span><span style="color:#D73A49">...</span><span style="color:#24292E">$xs)));</span></span>
+<span class="line"><span style="color:#24292E">$id </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> \</span><span style="color:#6F42C1">spl_object_id</span><span style="color:#24292E">(</span><span style="color:#D73A49">...</span><span style="color:#24292E">);</span></span>
+<span class="line"><span style="color:#24292E">$put </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($c) => </span><span style="color:#005CC5">\</span><span style="color:#005CC5">printf</span><span style="color:#24292E">(</span><span style="color:#032F62">'%c'</span><span style="color:#24292E">, $c);</span></span>
+<span class="line"><span style="color:#24292E">$mm </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($p, $n) => </span><span style="color:#D73A49">new</span><span style="color:#005CC5"> \ArrayObject</span><span style="color:#24292E">(</span><span style="color:#005CC5">\array_fill</span><span style="color:#24292E">(</span><span style="color:#D73A49">+!!</span><span style="color:#24292E">[], $n, $p));</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$👉 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) => [</span><span style="color:#D73A49">++</span><span style="color:#24292E">$mp, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc];</span></span>
+<span class="line"><span style="color:#24292E">$👈 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) => [</span><span style="color:#D73A49">--</span><span style="color:#24292E">$mp, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc];</span></span>
+<span class="line"><span style="color:#24292E">$👍 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) => [$mp, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$m[$mp]];</span></span>
+<span class="line"><span style="color:#24292E">$👎 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) => [$mp, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc, </span><span style="color:#D73A49">--</span><span style="color:#24292E">$m[$mp]];</span></span>
+<span class="line"><span style="color:#24292E">$📝 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) => [$mp, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc, $put($m[$mp])];</span></span>
+<span class="line"><span style="color:#24292E">$🤡 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) => </span><span style="color:#D73A49">match</span><span style="color:#24292E"> ($m[$mp]) {</span></span>
+<span class="line"><span style="color:#D73A49"> +!!</span><span style="color:#24292E">[] </span><span style="color:#D73A49">=></span><span style="color:#24292E"> [$mp, $z(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($loop) => </span><span style="color:#D73A49">fn</span><span style="color:#24292E">($pc, $n) => </span><span style="color:#D73A49">match</span><span style="color:#24292E"> ($id($p[$pc])) {</span></span>
+<span class="line"><span style="color:#24292E"> $b </span><span style="color:#D73A49">=></span><span style="color:#24292E"> $loop(</span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$n),</span></span>
+<span class="line"><span style="color:#24292E"> $e </span><span style="color:#D73A49">=></span><span style="color:#24292E"> $n </span><span style="color:#D73A49">===</span><span style="color:#D73A49"> +!!</span><span style="color:#24292E">[] </span><span style="color:#D73A49">?</span><span style="color:#D73A49"> ++</span><span style="color:#24292E">$pc </span><span style="color:#D73A49">:</span><span style="color:#24292E"> $loop(</span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc, </span><span style="color:#D73A49">--</span><span style="color:#24292E">$n),</span></span>
+<span class="line"><span style="color:#D73A49"> default</span><span style="color:#D73A49"> =></span><span style="color:#24292E"> $loop(</span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc, $n),</span></span>
+<span class="line"><span style="color:#24292E"> })($pc, </span><span style="color:#D73A49">-!</span><span style="color:#24292E">[])],</span></span>
+<span class="line"><span style="color:#D73A49"> default</span><span style="color:#D73A49"> =></span><span style="color:#24292E"> [$mp, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc],</span></span>
+<span class="line"><span style="color:#24292E">};</span></span>
+<span class="line"><span style="color:#24292E">$🎪 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) => </span><span style="color:#D73A49">match</span><span style="color:#24292E"> ($m[$mp]) {</span></span>
+<span class="line"><span style="color:#D73A49"> +!!</span><span style="color:#24292E">[] </span><span style="color:#D73A49">=></span><span style="color:#24292E"> [$mp, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$pc],</span></span>
+<span class="line"><span style="color:#D73A49"> default</span><span style="color:#D73A49"> =></span><span style="color:#24292E"> [$mp, $z(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($loop) => </span><span style="color:#D73A49">fn</span><span style="color:#24292E">($pc, $n) => </span><span style="color:#D73A49">match</span><span style="color:#24292E"> ($id($p[$pc])) {</span></span>
+<span class="line"><span style="color:#24292E"> $e </span><span style="color:#D73A49">=></span><span style="color:#24292E"> $loop(</span><span style="color:#D73A49">--</span><span style="color:#24292E">$pc, </span><span style="color:#D73A49">++</span><span style="color:#24292E">$n),</span></span>
+<span class="line"><span style="color:#24292E"> $b </span><span style="color:#D73A49">=></span><span style="color:#24292E"> $n </span><span style="color:#D73A49">===</span><span style="color:#D73A49"> +!!</span><span style="color:#24292E">[] </span><span style="color:#D73A49">?</span><span style="color:#24292E"> $pc</span><span style="color:#D73A49">+!</span><span style="color:#24292E">[] </span><span style="color:#D73A49">:</span><span style="color:#24292E"> $loop(</span><span style="color:#D73A49">--</span><span style="color:#24292E">$pc, </span><span style="color:#D73A49">--</span><span style="color:#24292E">$n),</span></span>
+<span class="line"><span style="color:#D73A49"> default</span><span style="color:#D73A49"> =></span><span style="color:#24292E"> $loop(</span><span style="color:#D73A49">--</span><span style="color:#24292E">$pc, $n),</span></span>
+<span class="line"><span style="color:#24292E"> })($pc, </span><span style="color:#D73A49">-!</span><span style="color:#24292E">[])],</span></span>
+<span class="line"><span style="color:#24292E">};</span></span>
+<span class="line"><span style="color:#24292E">$🐘 </span><span style="color:#D73A49">=</span><span style="color:#D73A49"> fn</span><span style="color:#24292E">($p) => $z(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($loop) => </span><span style="color:#D73A49">fn</span><span style="color:#24292E">($m, $p, $b, $e, $mp, $pc) =></span></span>
+<span class="line"><span style="color:#005CC5"> isset</span><span style="color:#24292E">($p[$pc]) </span><span style="color:#D73A49">&#x26;&#x26;</span><span style="color:#24292E"> $loop($m, $p, $b, $e, </span><span style="color:#D73A49">...</span><span style="color:#24292E">($p[$pc]($m, $p, $b, $e, $mp, $pc)))</span></span>
+<span class="line"><span style="color:#24292E">)($mm(</span><span style="color:#D73A49">+!!</span><span style="color:#24292E">[], </span><span style="color:#D73A49">+</span><span style="color:#24292E">(</span><span style="color:#D73A49">!</span><span style="color:#24292E">[]</span><span style="color:#D73A49">.</span><span style="color:#D73A49">!</span><span style="color:#24292E">[])), $p, $id($🤡), $id($🎪), </span><span style="color:#D73A49">+!!</span><span style="color:#24292E">[], </span><span style="color:#D73A49">+!!</span><span style="color:#24292E">[]);</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$🐘([</span></span>
+<span class="line"><span style="color:#24292E"> $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍,</span></span>
+<span class="line"><span style="color:#24292E"> $🤡,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👍, $👍, $👍,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👍, $👍, $👍, $👍, $👍,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍, $👍,</span></span>
+<span class="line"><span style="color:#24292E"> $👈, $👈, $👈, $👈, $👎,</span></span>
+<span class="line"><span style="color:#24292E"> $🎪,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👍, $👍, $👍, $👍, $👍, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👎, $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👎, $👎, $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👎, $👎, $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👎, $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👈, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👉, $👎, $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👍, $👍, $👍, $👍, $👍, $👍, $👍, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👈, $👎, $👎, $👎, $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👈, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👍, $👍, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👉, $👎, $📝,</span></span>
+<span class="line"><span style="color:#24292E"> $👈, $📝,</span></span>
+<span class="line"><span style="color:#24292E">]);</span></span></code></pre>
+ </div>
<p>
この問題は、単に適切なバージョンの PHP で動かせばトークンが得られる。
@@ -181,28 +182,30 @@ $🐘([
なお、brainf*ck プログラムを普通の書き方で書くと、次のようになる。
</p>
- <pre class="highlight"><code>+ + + + + + + + + +
-[
- &gt; + + +
- &gt; + + + + +
- &gt; + + + + + + + + + + + +
- &gt; + + + + + + + + + +
- &lt; &lt; &lt; &lt; -
-]
-&gt; + + + + + .
-- - .
-&gt; - - - .
-&gt; - - - .
-- - .
-- .
-&lt; .
-&gt; &gt; - - .
-+ + + + + + + .
-&lt; - - - - .
-&lt; .
-&gt; + + .
-&gt; - .
-&lt; .</code></pre>
+ <div class="codeblock">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>+ + + + + + + + + +</span></span>
+<span class="line"><span>[</span></span>
+<span class="line"><span> > + + +</span></span>
+<span class="line"><span> > + + + + +</span></span>
+<span class="line"><span> > + + + + + + + + + + + +</span></span>
+<span class="line"><span> > + + + + + + + + + +</span></span>
+<span class="line"><span> &#x3C; &#x3C; &#x3C; &#x3C; -</span></span>
+<span class="line"><span>]</span></span>
+<span class="line"><span>> + + + + + .</span></span>
+<span class="line"><span>- - .</span></span>
+<span class="line"><span>> - - - .</span></span>
+<span class="line"><span>> - - - .</span></span>
+<span class="line"><span>- - .</span></span>
+<span class="line"><span>- .</span></span>
+<span class="line"><span>&#x3C; .</span></span>
+<span class="line"><span>> > - - .</span></span>
+<span class="line"><span>+ + + + + + + .</span></span>
+<span class="line"><span>&#x3C; - - - - .</span></span>
+<span class="line"><span>&#x3C; .</span></span>
+<span class="line"><span>> + + .</span></span>
+<span class="line"><span>> - .</span></span>
+<span class="line"><span>&#x3C; .</span></span></code></pre>
+ </div>
<p>
実行結果はこちら: <a href="https://ideone.com/22VWmb" rel="noreferrer" target="_blank">https://ideone.com/22VWmb</a>
@@ -271,7 +274,9 @@ $🐘([
ソースコードのライセンスを示したこの部分だが、
</p>
- <pre class="highlight" language="php"><code class="highlight">https:<span class="hljs-comment">//creativecommons.org/publicdomain/zero/1.0/</span></code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6F42C1">https</span><span style="color:#24292E">:</span><span style="color:#6A737D">//creativecommons.org/publicdomain/zero/1.0/</span></span></code></pre>
+ </div>
<p>
完全に合法な PHP のコードである。 <code>https:</code> 部分はラベル、<code>//</code> 以降は行コメントになっている。
@@ -284,11 +289,13 @@ $🐘([
ソースコード中に、ほとんど数値リテラルが書かれていないことにお気づきだろうか。PHP では、型変換を利用することで任意の整数を作り出すことができる。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-number">0</span> === +!![]);
-<span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-number">1</span> === +![]);
-<span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-number">2</span> === ![]+![]);
-<span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-number">3</span> === ![]+![]+![]);
-<span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-number">10</span> === +(![].+!![]));</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">0</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> +!!</span><span style="color:#24292E">[]);</span></span>
+<span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">1</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> +!</span><span style="color:#24292E">[]);</span></span>
+<span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">2</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> !</span><span style="color:#24292E">[]</span><span style="color:#D73A49">+!</span><span style="color:#24292E">[]);</span></span>
+<span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">3</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> !</span><span style="color:#24292E">[]</span><span style="color:#D73A49">+!</span><span style="color:#24292E">[]</span><span style="color:#D73A49">+!</span><span style="color:#24292E">[]);</span></span>
+<span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">10</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> +</span><span style="color:#24292E">(</span><span style="color:#D73A49">!</span><span style="color:#24292E">[]</span><span style="color:#D73A49">.</span><span style="color:#D73A49">+!!</span><span style="color:#24292E">[]));</span></span></code></pre>
+ </div>
<p>
<code>[]</code> に <code>!</code> を適用すると <code>true</code> が返ってくる。それに <code>+</code> を適用すると、<code>bool</code> から <code>int</code> ヘの型変換が走り、<code>1</code> が生成される。<code>10</code> はさらにトリッキーだ。まず <code>1</code> と <code>0</code> を作り、<code>.</code> で文字列として結合する (<code>&apos;10&apos;</code>)。これに <code>+</code> を適用すると、<code>string</code> から <code>int</code> への型変換が走り、<code>10</code> が生まれる (コード量に頓着しないなら、<code>1</code> を 10 個足し合わせてももちろん 10 が作れる)。
@@ -329,40 +336,42 @@ $🐘([
ソースコードはこちら。実行には PHP 8.0 以上が必要なので注意。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-meta">&lt;?php</span>
-
-<span class="hljs-comment">/*********************************************************
- * This program displays a PHPer token. *
- * Guess &#x27;N&#x27;. *
- * *
- * Hints: *
- * - N itself has no special meaning, e.g., 42, 8128, *
- * it is selected at random. *
- * - Each element of $token represents a single letter. *
- * - One letter consists of 5x5 cells. *
- * - Remember, the output is a complete PHPer token. *
- * *
- * License: *
- * https://creativecommons.org/publicdomain/zero/1.0/ *
- *********************************************************/</span>
-<span class="hljs-keyword">const</span> <span class="hljs-variable constant_">N</span> = <span class="hljs-number">0</span> <span class="hljs-comment">/* Change it to your answer. */</span>;
-<span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-number">0</span> &lt;= N &amp;&amp; N &lt;= <span class="hljs-number">0b11111_11111_11111_11111_11111</span>);
-
-<span class="hljs-variable">$token</span> = [
- <span class="hljs-number">0x14B499C</span>,
- <span class="hljs-number">0x0BE34CC</span>, <span class="hljs-number">0x01C9C69</span>,
- <span class="hljs-number">0x0ECA069</span>, <span class="hljs-number">0x01C2449</span>, <span class="hljs-number">0x0FDB166</span>, <span class="hljs-number">0x01C9C69</span>,
- <span class="hljs-number">0x01C1C66</span>, <span class="hljs-number">0x0FC1C47</span>, <span class="hljs-number">0x01C1C66</span>,
- <span class="hljs-number">0x10C5858</span>, <span class="hljs-number">0x1E4E3B8</span>, <span class="hljs-number">0x1A2F2F8</span>,
-];
-<span class="hljs-keyword">foreach</span> (<span class="hljs-variable">$token</span> <span class="hljs-keyword">as</span> <span class="hljs-variable">$x</span>) {
- <span class="hljs-variable">$x</span> = <span class="hljs-variable">$x</span> ^ N;
-
- <span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">sprintf</span>(<span class="hljs-string">&#x27;%025b&#x27;</span>, <span class="hljs-variable">$x</span>);
- <span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">str_replace</span>(<span class="hljs-attr">search</span>: [<span class="hljs-string">&#x27;0&#x27;</span>, <span class="hljs-string">&#x27;1&#x27;</span>], <span class="hljs-attr">replace</span>: [<span class="hljs-string">&#x27; &#x27;</span>, <span class="hljs-string">&#x27;#&#x27;</span>], <span class="hljs-attr">subject</span>: <span class="hljs-variable">$x</span>);
- <span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">&quot;\n&quot;</span>, <span class="hljs-title function_ invoke__">str_split</span>(<span class="hljs-variable">$x</span>, <span class="hljs-attr">length</span>: <span class="hljs-number">5</span>));
- <span class="hljs-keyword">echo</span> <span class="hljs-string">&quot;<span class="hljs-subst">{$x}</span>\n\n&quot;</span>;
-}</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">&#x3C;?</span><span style="color:#005CC5">php</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#6A737D">/*********************************************************</span></span>
+<span class="line"><span style="color:#6A737D"> * This program displays a PHPer token. *</span></span>
+<span class="line"><span style="color:#6A737D"> * Guess 'N'. *</span></span>
+<span class="line"><span style="color:#6A737D"> * *</span></span>
+<span class="line"><span style="color:#6A737D"> * Hints: *</span></span>
+<span class="line"><span style="color:#6A737D"> * - N itself has no special meaning, e.g., 42, 8128, *</span></span>
+<span class="line"><span style="color:#6A737D"> * it is selected at random. *</span></span>
+<span class="line"><span style="color:#6A737D"> * - Each element of $token represents a single letter. *</span></span>
+<span class="line"><span style="color:#6A737D"> * - One letter consists of 5x5 cells. *</span></span>
+<span class="line"><span style="color:#6A737D"> * - Remember, the output is a complete PHPer token. *</span></span>
+<span class="line"><span style="color:#6A737D"> * *</span></span>
+<span class="line"><span style="color:#6A737D"> * License: *</span></span>
+<span class="line"><span style="color:#6A737D"> * https://creativecommons.org/publicdomain/zero/1.0/ *</span></span>
+<span class="line"><span style="color:#6A737D"> *********************************************************/</span></span>
+<span class="line"><span style="color:#D73A49">const</span><span style="color:#005CC5"> N</span><span style="color:#D73A49"> =</span><span style="color:#005CC5"> 0</span><span style="color:#6A737D"> /* Change it to your answer. */</span><span style="color:#24292E">;</span></span>
+<span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">0</span><span style="color:#D73A49"> &#x3C;=</span><span style="color:#005CC5"> N</span><span style="color:#D73A49"> &#x26;&#x26;</span><span style="color:#005CC5"> N</span><span style="color:#D73A49"> &#x3C;=</span><span style="color:#005CC5"> 0b11111_11111_11111_11111_11111</span><span style="color:#24292E">);</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$token </span><span style="color:#D73A49">=</span><span style="color:#24292E"> [</span></span>
+<span class="line"><span style="color:#005CC5"> 0x14B499C</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#005CC5"> 0x0BE34CC</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x01C9C69</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#005CC5"> 0x0ECA069</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x01C2449</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x0FDB166</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x01C9C69</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#005CC5"> 0x01C1C66</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x0FC1C47</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x01C1C66</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#005CC5"> 0x10C5858</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1E4E3B8</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1A2F2F8</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#24292E">];</span></span>
+<span class="line"><span style="color:#D73A49">foreach</span><span style="color:#24292E"> ($token </span><span style="color:#D73A49">as</span><span style="color:#24292E"> $x) {</span></span>
+<span class="line"><span style="color:#24292E"> $x </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $x </span><span style="color:#D73A49">^</span><span style="color:#005CC5"> N</span><span style="color:#24292E">;</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E"> $x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> sprintf</span><span style="color:#24292E">(</span><span style="color:#032F62">'%025b'</span><span style="color:#24292E">, $x);</span></span>
+<span class="line"><span style="color:#24292E"> $x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> str_replace</span><span style="color:#24292E">(</span><span style="color:#6F42C1">search</span><span style="color:#24292E">: [</span><span style="color:#032F62">'0'</span><span style="color:#24292E">, </span><span style="color:#032F62">'1'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">replace</span><span style="color:#24292E">: [</span><span style="color:#032F62">' '</span><span style="color:#24292E">, </span><span style="color:#032F62">'#'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">subject</span><span style="color:#24292E">: $x);</span></span>
+<span class="line"><span style="color:#24292E"> $x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, </span><span style="color:#005CC5">str_split</span><span style="color:#24292E">($x, </span><span style="color:#6F42C1">length</span><span style="color:#24292E">: </span><span style="color:#005CC5">5</span><span style="color:#24292E">));</span></span>
+<span class="line"><span style="color:#005CC5"> echo</span><span style="color:#032F62"> "{</span><span style="color:#24292E">$x</span><span style="color:#032F62">}</span><span style="color:#005CC5">\n\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span>
+<span class="line"><span style="color:#24292E">}</span></span></code></pre>
+ </div>
<p>
さて、この問題はさきほどのように単純に実行しただけでは、謎のブロックが表示されるだけでトークンは得られない。トークンを得るためには、ソースコードを読み、定数 <code>N</code> を特定する必要がある。
@@ -378,33 +387,43 @@ $🐘([
まずはソースコードを読んでいく。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-variable">$token</span> = [
-<span class="hljs-comment">// 略</span>
-];</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$token </span><span style="color:#D73A49">=</span><span style="color:#24292E"> [</span></span>
+<span class="line"><span style="color:#6A737D">// 略</span></span>
+<span class="line"><span style="color:#24292E">];</span></span></code></pre>
+ </div>
<p>
数値からなる <code>$token</code> があり、各要素をループしている。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-variable">$x</span> = <span class="hljs-variable">$x</span> ^ N;</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $x </span><span style="color:#D73A49">^</span><span style="color:#005CC5"> N</span><span style="color:#24292E">;</span></span></code></pre>
+ </div>
<p>
まずは排他的論理和 (xor) を取り、
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">sprintf</span>(<span class="hljs-string">&#x27;%025b&#x27;</span>, <span class="hljs-variable">$x</span>);</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> sprintf</span><span style="color:#24292E">(</span><span style="color:#032F62">'%025b'</span><span style="color:#24292E">, $x);</span></span></code></pre>
+ </div>
<p>
二進数に変換して、
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">str_replace</span>(<span class="hljs-attr">search</span>: [<span class="hljs-string">&#x27;0&#x27;</span>, <span class="hljs-string">&#x27;1&#x27;</span>], <span class="hljs-attr">replace</span>: [<span class="hljs-string">&#x27; &#x27;</span>, <span class="hljs-string">&#x27;#&#x27;</span>], <span class="hljs-attr">subject</span>: <span class="hljs-variable">$x</span>);</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> str_replace</span><span style="color:#24292E">(</span><span style="color:#6F42C1">search</span><span style="color:#24292E">: [</span><span style="color:#032F62">'0'</span><span style="color:#24292E">, </span><span style="color:#032F62">'1'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">replace</span><span style="color:#24292E">: [</span><span style="color:#032F62">' '</span><span style="color:#24292E">, </span><span style="color:#032F62">'#'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">subject</span><span style="color:#24292E">: $x);</span></span></code></pre>
+ </div>
<p>
0 を空白に、1 を <code>#</code> にし、
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">&quot;\n&quot;</span>, <span class="hljs-title function_ invoke__">str_split</span>(<span class="hljs-variable">$x</span>, <span class="hljs-attr">length</span>: <span class="hljs-number">5</span>));</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, </span><span style="color:#005CC5">str_split</span><span style="color:#24292E">($x, </span><span style="color:#6F42C1">length</span><span style="color:#24292E">: </span><span style="color:#005CC5">5</span><span style="color:#24292E">));</span></span></code></pre>
+ </div>
<p>
5文字ごとに区切ったあと、改行で結合している。
@@ -450,49 +469,55 @@ $🐘([
<code>N</code> は高々
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-number">0</span> &lt;= N &amp;&amp; N &lt;= <span class="hljs-number">0b11111_11111_11111_11111_11111</span>);</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">0</span><span style="color:#D73A49"> &#x3C;=</span><span style="color:#005CC5"> N</span><span style="color:#D73A49"> &#x26;&#x26;</span><span style="color:#005CC5"> N</span><span style="color:#D73A49"> &#x3C;=</span><span style="color:#005CC5"> 0b11111_11111_11111_11111_11111</span><span style="color:#24292E">);</span></span></code></pre>
+ </div>
<p>
なのでブルートフォースしてもよいが、ここではブルートフォースしない方法を紹介する。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-meta">&lt;?php</span>
-
-<span class="hljs-variable">$x</span> = <span class="hljs-number">0x14B499C</span>;
-
-<span class="hljs-variable">$x</span> = <span class="hljs-variable">$x</span> ^ N;
-
-<span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">sprintf</span>(<span class="hljs-string">&#x27;%025b&#x27;</span>, <span class="hljs-variable">$x</span>);
-<span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">str_replace</span>(<span class="hljs-attr">search</span>: [<span class="hljs-string">&#x27;0&#x27;</span>, <span class="hljs-string">&#x27;1&#x27;</span>], <span class="hljs-attr">replace</span>: [<span class="hljs-string">&#x27; &#x27;</span>, <span class="hljs-string">&#x27;#&#x27;</span>], <span class="hljs-attr">subject</span>: <span class="hljs-variable">$x</span>);
-<span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">&quot;\n&quot;</span>, <span class="hljs-title function_ invoke__">str_split</span>(<span class="hljs-variable">$x</span>, <span class="hljs-attr">length</span>: <span class="hljs-number">5</span>));
-
-<span class="hljs-title function_ invoke__">assert</span>(<span class="hljs-variable">$x</span> ===
-<span class="hljs-string">&quot; # # \n&quot;</span> .
-<span class="hljs-string">&quot;#####\n&quot;</span> .
-<span class="hljs-string">&quot; # # \n&quot;</span> .
-<span class="hljs-string">&quot;#####\n&quot;</span> .
-<span class="hljs-string">&quot; # # &quot;</span>);</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">&#x3C;?</span><span style="color:#005CC5">php</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> 0x14B499C</span><span style="color:#24292E">;</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $x </span><span style="color:#D73A49">^</span><span style="color:#005CC5"> N</span><span style="color:#24292E">;</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> sprintf</span><span style="color:#24292E">(</span><span style="color:#032F62">'%025b'</span><span style="color:#24292E">, $x);</span></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> str_replace</span><span style="color:#24292E">(</span><span style="color:#6F42C1">search</span><span style="color:#24292E">: [</span><span style="color:#032F62">'0'</span><span style="color:#24292E">, </span><span style="color:#032F62">'1'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">replace</span><span style="color:#24292E">: [</span><span style="color:#032F62">' '</span><span style="color:#24292E">, </span><span style="color:#032F62">'#'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">subject</span><span style="color:#24292E">: $x);</span></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, </span><span style="color:#005CC5">str_split</span><span style="color:#24292E">($x, </span><span style="color:#6F42C1">length</span><span style="color:#24292E">: </span><span style="color:#005CC5">5</span><span style="color:#24292E">));</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">($x </span><span style="color:#D73A49">===</span></span>
+<span class="line"><span style="color:#032F62">" # # </span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">"#####</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">" # # </span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">"#####</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">" # # "</span><span style="color:#24292E">);</span></span></code></pre>
+ </div>
<p>
この一連の変換に対する逆変換を考えると、次のようになる。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-meta">&lt;?php</span>
-
-<span class="hljs-variable">$x</span> =
-<span class="hljs-string">&quot; # # \n&quot;</span> .
-<span class="hljs-string">&quot;#####\n&quot;</span> .
-<span class="hljs-string">&quot; # # \n&quot;</span> .
-<span class="hljs-string">&quot;#####\n&quot;</span> .
-<span class="hljs-string">&quot; # # &quot;</span>;
-
-<span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">&#x27;&#x27;</span>, <span class="hljs-title function_ invoke__">explode</span>(<span class="hljs-string">&quot;\n&quot;</span>, <span class="hljs-variable">$x</span>));
-<span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">str_replace</span>(<span class="hljs-attr">search</span>: [<span class="hljs-string">&#x27; &#x27;</span>, <span class="hljs-string">&#x27;#&#x27;</span>], <span class="hljs-attr">replace</span>: [<span class="hljs-string">&#x27;0&#x27;</span>, <span class="hljs-string">&#x27;1&#x27;</span>], <span class="hljs-attr">subject</span>: <span class="hljs-variable">$x</span>);
-<span class="hljs-variable">$x</span> = <span class="hljs-title function_ invoke__">bindec</span>(<span class="hljs-variable">$x</span>);
-
-<span class="hljs-variable">$n</span> = <span class="hljs-variable">$x</span> ^ <span class="hljs-number">0x14B499C</span>;
-
-<span class="hljs-keyword">echo</span> <span class="hljs-string">&quot;N = <span class="hljs-subst">$n</span>\n&quot;</span>;</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">&#x3C;?</span><span style="color:#005CC5">php</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span></span>
+<span class="line"><span style="color:#032F62">" # # </span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">"#####</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">" # # </span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">"#####</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span>
+<span class="line"><span style="color:#032F62">" # # "</span><span style="color:#24292E">;</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#032F62">''</span><span style="color:#24292E">, </span><span style="color:#005CC5">explode</span><span style="color:#24292E">(</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, $x));</span></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> str_replace</span><span style="color:#24292E">(</span><span style="color:#6F42C1">search</span><span style="color:#24292E">: [</span><span style="color:#032F62">' '</span><span style="color:#24292E">, </span><span style="color:#032F62">'#'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">replace</span><span style="color:#24292E">: [</span><span style="color:#032F62">'0'</span><span style="color:#24292E">, </span><span style="color:#032F62">'1'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">subject</span><span style="color:#24292E">: $x);</span></span>
+<span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> bindec</span><span style="color:#24292E">($x);</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$n </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $x </span><span style="color:#D73A49">^</span><span style="color:#005CC5"> 0x14B499C</span><span style="color:#24292E">;</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#005CC5">echo</span><span style="color:#032F62"> "N = </span><span style="color:#24292E">$n</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span></code></pre>
+ </div>
<p>
これを実行すると、<code>N</code> が得られる。
@@ -506,41 +531,45 @@ $🐘([
ソースコードはこちら。
</p>
- <pre class="highlight" language="php"><code class="highlight"><span class="hljs-meta">&lt;?php</span>
-
-<span class="hljs-comment">// License: https://creativecommons.org/publicdomain/zero/1.0/</span>
-<span class="hljs-comment">// This is a quine-like program to generate a PHPer token.</span>
-<span class="hljs-comment">// Execute it like this: php toquine.php | php | php | php | ...</span>
-
-<span class="hljs-variable">$s</span> = <span class="hljs-string">&lt;&lt;&lt;&#x27;Q&#x27;
-&lt;?cuc
-// Yvprafr: uggcf://perngvirpbzzbaf.bet/choyvpqbznva/mreb/1.0/
-// Guvf vf n dhvar-yvxr cebtenz gb trarengr n CUCre gbxra.
-// Rkrphgr vg yvxr guvf: cuc gbdhvar.cuc | cuc | cuc | cuc | ...
-%f$f = %f;
-$f = fge_ebg13($f); $kf = [
-%f,
-];
-$g = ahyy.snyfr; sbe ($v = 0; $v &lt;= vagqvi(__YVAR__-035,6); ++$v) vs (!vffrg($kf[$v])) oernx; ryfr
-$g .= vzcybqr(&quot;\a&quot;, fge_fcyvg(fge_ercynpr([&#x27;0&#x27;,&#x27;1&#x27;], [&#x27; &#x27;,&#x27;##&#x27;], fcevags(pue(37) . &#x27;025o&#x27;, $kf[$v])), 012)) . &quot;\a\a&quot;;
-$jf = neenl_znc(sa($j) =&gt; vzcybqr(&#x27;, &#x27;, $j), neenl_puhax(neenl_znc(sa($k) =&gt; fcevags(&#x27;0k&#x27; . pue(37) . &#x27;07K&#x27;, $k), $kf), 10));
-cevags($f, $g, fge_ebg13(&quot;&lt;&lt;&lt;&#x27;Q</span><span class="hljs-string">&#x27;\a{$f}\aQ&quot;), vzcybqr(&quot;,\a&quot;, $jf));
-Q;
-$s = str_rot13($s); $xs = [
-0x0AFABEA, 0x1F294A7, 0x1F2109F, 0x1F294A7, 0x0002800, 0x1F2109F, 0x0117041, 0x1F294A7, 0x1FAD6B5, 0x1F295B7,
-0x010FC21, 0x1FAD6B5, 0x1151151, 0x010FC21, 0x1F294A7, 0x1F295B7, 0x1FAD6B5, 0x1F294A7, 0x1F295B7, 0x1F8C63F,
-0x1F8C631, 0x1FAD6B5, 0x17AD6BD, 0x17AD6BD, 0x1F8C63F, 0x1F295B7,
-];
-$t = null.false; for ($i = 0; $i &lt;= intdiv(__LINE__-035,6); ++$i) if (!isset($xs[$i])) break; else
-$t .= implode(&quot;\n&quot;, str_split(str_replace([&#x27;</span><span class="hljs-number">0</span><span class="hljs-string">&#x27;,&#x27;</span><span class="hljs-number">1</span><span class="hljs-string">&#x27;], [&#x27;</span> <span class="hljs-string">&#x27;,&#x27;</span><span class="hljs-comment">##&#x27;], sprintf(chr(37) . &#x27;025b&#x27;, $xs[$i])), 012)) . &quot;\n\n&quot;;</span>
-<span class="hljs-variable">$ws</span> = <span class="hljs-title function_ invoke__">array_map</span>(fn(<span class="hljs-variable">$w</span>) =&gt; <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">&#x27;, &#x27;</span>, <span class="hljs-variable">$w</span>), <span class="hljs-title function_ invoke__">array_chunk</span>(<span class="hljs-title function_ invoke__">array_map</span>(fn(<span class="hljs-variable">$x</span>) =&gt; <span class="hljs-title function_ invoke__">sprintf</span>(<span class="hljs-string">&#x27;0x&#x27;</span> . <span class="hljs-title function_ invoke__">chr</span>(<span class="hljs-number">37</span>) . <span class="hljs-string">&#x27;07X&#x27;</span>, <span class="hljs-variable">$x</span>), <span class="hljs-variable">$xs</span>), <span class="hljs-number">10</span>));
-<span class="hljs-title function_ invoke__">printf</span>(<span class="hljs-variable">$s</span>, <span class="hljs-variable">$t</span>, <span class="hljs-title function_ invoke__">str_rot13</span>(<span class="hljs-string">&quot;&lt;&lt;&lt;&#x27;D&#x27;\n<span class="hljs-subst">{$s}</span>\nD&quot;</span>), <span class="hljs-title function_ invoke__">implode</span>(<span class="hljs-string">&quot;,\n&quot;</span>, <span class="hljs-variable">$ws</span>));</code></pre>
+ <div class="codeblock" language="php">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">&#x3C;?</span><span style="color:#005CC5">php</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#6A737D">// License: https://creativecommons.org/publicdomain/zero/1.0/</span></span>
+<span class="line"><span style="color:#6A737D">// This is a quine-like program to generate a PHPer token.</span></span>
+<span class="line"><span style="color:#6A737D">// Execute it like this: php toquine.php | php | php | php | ...</span></span>
+<span class="line"></span>
+<span class="line"><span style="color:#24292E">$s </span><span style="color:#D73A49">=</span><span style="color:#032F62"> &#x3C;&#x3C;&#x3C;'</span><span style="color:#D73A49">Q</span><span style="color:#032F62">'</span></span>
+<span class="line"><span style="color:#032F62">&#x3C;?cuc</span></span>
+<span class="line"><span style="color:#032F62">// Yvprafr: uggcf://perngvirpbzzbaf.bet/choyvpqbznva/mreb/1.0/</span></span>
+<span class="line"><span style="color:#032F62">// Guvf vf n dhvar-yvxr cebtenz gb trarengr n CUCre gbxra.</span></span>
+<span class="line"><span style="color:#032F62">// Rkrphgr vg yvxr guvf: cuc gbdhvar.cuc | cuc | cuc | cuc | ...</span></span>
+<span class="line"><span style="color:#032F62">%f$f = %f;</span></span>
+<span class="line"><span style="color:#032F62">$f = fge_ebg13($f); $kf = [</span></span>
+<span class="line"><span style="color:#032F62">%f,</span></span>
+<span class="line"><span style="color:#032F62">];</span></span>
+<span class="line"><span style="color:#032F62">$g = ahyy.snyfr; sbe ($v = 0; $v &#x3C;= vagqvi(__YVAR__-035,6); ++$v) vs (!vffrg($kf[$v])) oernx; ryfr</span></span>
+<span class="line"><span style="color:#032F62">$g .= vzcybqr("\a", fge_fcyvg(fge_ercynpr(['0','1'], [' ','##'], fcevags(pue(37) . '025o', $kf[$v])), 012)) . "\a\a";</span></span>
+<span class="line"><span style="color:#032F62">$jf = neenl_znc(sa($j) => vzcybqr(', ', $j), neenl_puhax(neenl_znc(sa($k) => fcevags('0k' . pue(37) . '07K', $k), $kf), 10));</span></span>
+<span class="line"><span style="color:#032F62">cevags($f, $g, fge_ebg13("&#x3C;&#x3C;&#x3C;'Q'\a{$f}\aQ"), vzcybqr(",\a", $jf));</span></span>
+<span class="line"><span style="color:#D73A49">Q</span><span style="color:#24292E">;</span></span>
+<span class="line"><span style="color:#24292E">$s </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> str_rot13</span><span style="color:#24292E">($s); $xs </span><span style="color:#D73A49">=</span><span style="color:#24292E"> [</span></span>
+<span class="line"><span style="color:#005CC5">0x0AFABEA</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F294A7</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F2109F</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F294A7</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x0002800</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F2109F</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x0117041</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F294A7</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1FAD6B5</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F295B7</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#005CC5">0x010FC21</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1FAD6B5</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1151151</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x010FC21</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F294A7</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F295B7</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1FAD6B5</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F294A7</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F295B7</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F8C63F</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#005CC5">0x1F8C631</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1FAD6B5</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x17AD6BD</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x17AD6BD</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F8C63F</span><span style="color:#24292E">, </span><span style="color:#005CC5">0x1F295B7</span><span style="color:#24292E">,</span></span>
+<span class="line"><span style="color:#24292E">];</span></span>
+<span class="line"><span style="color:#24292E">$t </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> null</span><span style="color:#D73A49">.</span><span style="color:#005CC5">false</span><span style="color:#24292E">; </span><span style="color:#D73A49">for</span><span style="color:#24292E"> ($i </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> 0</span><span style="color:#24292E">; $i </span><span style="color:#D73A49">&#x3C;=</span><span style="color:#6F42C1"> intdiv</span><span style="color:#24292E">(</span><span style="color:#005CC5">__LINE__</span><span style="color:#D73A49">-</span><span style="color:#005CC5">035</span><span style="color:#24292E">,</span><span style="color:#005CC5">6</span><span style="color:#24292E">); </span><span style="color:#D73A49">++</span><span style="color:#24292E">$i) </span><span style="color:#D73A49">if</span><span style="color:#24292E"> (</span><span style="color:#D73A49">!</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($xs[$i])) </span><span style="color:#D73A49">break</span><span style="color:#24292E">; </span><span style="color:#D73A49">else</span></span>
+<span class="line"><span style="color:#24292E">$t </span><span style="color:#D73A49">.=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, </span><span style="color:#005CC5">str_split</span><span style="color:#24292E">(</span><span style="color:#005CC5">str_replace</span><span style="color:#24292E">([</span><span style="color:#032F62">'0'</span><span style="color:#24292E">,</span><span style="color:#032F62">'1'</span><span style="color:#24292E">], [</span><span style="color:#032F62">' '</span><span style="color:#24292E">,</span><span style="color:#032F62">'##'</span><span style="color:#24292E">], </span><span style="color:#005CC5">sprintf</span><span style="color:#24292E">(</span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">37</span><span style="color:#24292E">) </span><span style="color:#D73A49">.</span><span style="color:#032F62"> '025b'</span><span style="color:#24292E">, $xs[$i])), </span><span style="color:#005CC5">012</span><span style="color:#24292E">)) </span><span style="color:#D73A49">.</span><span style="color:#032F62"> "</span><span style="color:#005CC5">\n\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span>
+<span class="line"><span style="color:#24292E">$ws </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> array_map</span><span style="color:#24292E">(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($w) => </span><span style="color:#005CC5">implode</span><span style="color:#24292E">(</span><span style="color:#032F62">', '</span><span style="color:#24292E">, $w), </span><span style="color:#005CC5">array_chunk</span><span style="color:#24292E">(</span><span style="color:#005CC5">array_map</span><span style="color:#24292E">(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($x) => </span><span style="color:#005CC5">sprintf</span><span style="color:#24292E">(</span><span style="color:#032F62">'0x'</span><span style="color:#D73A49"> .</span><span style="color:#005CC5"> chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">37</span><span style="color:#24292E">) </span><span style="color:#D73A49">.</span><span style="color:#032F62"> '07X'</span><span style="color:#24292E">, $x), $xs), </span><span style="color:#005CC5">10</span><span style="color:#24292E">));</span></span>
+<span class="line"><span style="color:#005CC5">printf</span><span style="color:#24292E">($s, $t, </span><span style="color:#005CC5">str_rot13</span><span style="color:#24292E">(</span><span style="color:#032F62">"&#x3C;&#x3C;&#x3C;'D'</span><span style="color:#005CC5">\n</span><span style="color:#032F62">{</span><span style="color:#24292E">$s</span><span style="color:#032F62">}</span><span style="color:#005CC5">\n</span><span style="color:#032F62">D"</span><span style="color:#24292E">), </span><span style="color:#005CC5">implode</span><span style="color:#24292E">(</span><span style="color:#032F62">",</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, $ws));</span></span></code></pre>
+ </div>
<p>
コメントにもあるとおり、次のようにして実行すれば答えがでてくる。
</p>
- <pre class="highlight" language="shell-session"><code>$ php toquine.php | php | php | php | ...</code></pre>
+ <div class="codeblock" language="shell-session">
+ <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ php toquine.php | php | php | php | ...</span></span></code></pre>
+ </div>
<p>
実際にはもう少しパイプで繋げなければならない。