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.4.120.0060.00424.05
8.4.110.0150.00518.83
8.4.100.0100.00817.78
8.4.90.0120.00922.55
8.4.80.0060.00417.83
8.4.70.0080.00417.74
8.4.60.0110.00920.28
8.4.50.0110.01118.05
8.4.40.0090.01317.70
8.4.30.0000.01620.18
8.4.20.0160.00417.66
8.4.10.0060.00319.75
8.3.250.0100.00918.94
8.3.240.0100.00716.99
8.3.230.0060.00616.36
8.3.220.0120.00617.36
8.3.210.0030.00416.81
8.3.200.0050.00416.69
8.3.190.0110.00716.64
8.3.180.0090.00916.39
8.3.170.0040.01116.74
8.3.160.0140.00718.31
8.3.150.0070.01120.89
8.3.140.0090.00017.29
8.3.130.0080.00018.55
8.3.120.0040.00418.91
8.3.110.0140.00718.22
8.3.100.0090.00020.53
8.3.90.0000.00926.77
8.3.80.0100.00019.36
8.3.70.0130.00918.18
8.3.60.0030.01716.75
8.3.50.0090.01124.41
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.290.0090.00920.32
8.2.280.0050.00418.52
8.2.270.0110.00716.67
8.2.260.0070.01117.41
8.2.250.0050.00316.92
8.2.240.0130.00718.98
8.2.230.0030.00620.94
8.2.220.0070.00724.06
8.2.210.0030.00626.77
8.2.200.0000.00918.88
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.330.0100.01021.95
8.1.320.0120.00716.10
8.1.310.0090.00616.75
8.1.300.0060.01216.09
8.1.290.0070.00330.84
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:
79.24 ms | 403 KiB | 5 Q