3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Janken; use Closure; const WIN_LOSE_TABLE = [ 'グー' => ['チョキ' => 1, 'パー' => -1], 'チョキ' => ['パー' => 1, 'グー' => -1], 'パー' => ['グー' => 1, 'チョキ' => -1], ]; const EMOJI_TABLE = [ 'グー' => '✊', 'チョキ' => '✌', 'パー' => '🖐', ]; $printer = fn(string $my_hand, string $your_hand, int $result): string => sprintf("[%s vs %s] %s", EMOJI_TABLE[$my_hand], EMOJI_TABLE[$your_hand], match ($result) { -1 => 'あなたの負け', 0 => 'あいこ', 1 => 'あなたの勝ち', } ); foreach (['グー', 'チョキ', 'パー'] as $my_hand) { foreach (['グー', 'チョキ', 'パー'] as $your_hand) { echo battle($my_hand, $your_hand, $printer), PHP_EOL; } } function battle(string $my_hand, string $your_hand, Closure $printer): string { return $printer($my_hand, $your_hand, WIN_LOSE_TABLE[$my_hand][$your_hand] ?? 0); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.70.0130.00918.18
8.3.60.0030.01716.75
8.3.50.0070.01417.99
8.3.40.0100.00618.85
8.3.30.0070.00718.45
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0190.00326.16
8.2.190.0150.00018.18
8.2.180.0070.00725.92
8.2.170.0120.00318.94
8.2.160.0060.00922.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00419.76
8.2.110.0070.00720.52
8.2.100.0000.01120.53
8.1.280.0180.00025.92
8.1.270.0070.00723.99
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0100.00018.98
8.1.230.0030.01019.11
8.0.30.0100.00717.24
8.0.20.0130.00817.13
8.0.10.0130.00717.11
8.0.00.0110.01117.04
7.4.160.0070.00716.43
7.4.150.0110.00916.29
7.4.140.0140.00616.35
7.4.130.0110.00816.15
7.4.120.0120.00816.28
7.4.110.0130.00816.38
7.4.100.0110.00816.29
7.4.90.0130.00716.19
7.4.80.0110.00916.40
7.4.70.0110.00916.28
7.4.60.0120.00616.32
7.4.50.0090.01016.26
7.4.40.0130.00816.25
7.4.30.0120.00816.32
7.4.20.0120.00916.31
7.4.10.0120.00716.20
7.4.00.0080.01116.34
7.3.270.0120.00816.20
7.3.260.0140.00816.22
7.3.250.0120.00816.23
7.3.240.0120.00916.19
7.3.230.0110.00816.18
7.3.220.0100.00916.24
7.3.210.0150.00616.10
7.3.200.0120.00716.21
7.3.190.0110.00816.21
7.3.180.0090.00816.19
7.3.170.0110.00916.20
7.3.160.0130.00716.20
7.3.150.0120.00816.18
7.3.140.0120.00816.24
7.3.130.0110.00816.21
7.3.120.0110.00716.17
7.3.110.0110.00816.24
7.3.100.0100.01016.17
7.3.90.0120.00716.18
7.3.80.0120.00716.18
7.3.70.0140.00516.10
7.3.60.0110.00716.09
7.3.50.0100.01016.17
7.3.40.0100.00916.19
7.3.30.0110.00816.11
7.3.20.0220.00516.23
7.3.10.0150.00616.16
7.3.00.0120.00916.20

preferences:
21.2 ms | 401 KiB | 5 Q