3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generatePattern($n) { // Assure-toi que l'entrée est un nombre entier if (!is_int($n) || $n <= 0) { return "Veuillez entrer un nombre entier positif."; } // Boucle pour générer chaque ligne for ($i = $n; $i >= 1; $i--) { // Génère une ligne avec le chiffre $n répété $i fois echo str_repeat($n, $i) . PHP_EOL; } } generatePattern(2); echo "\n"; generatePattern(3); echo "\n"; generatePattern(4); echo "\n"; generatePattern(5);

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.130.0400.00616.18
8.3.120.0330.01116.42
8.3.110.0180.00516.48
8.3.100.0140.00716.27
8.3.90.0120.00916.40
8.3.80.0180.01316.30
8.3.70.0180.00416.60
8.3.60.0180.00416.52
8.3.50.0150.00816.71
8.3.40.0130.00717.25
8.3.30.0270.00017.21
8.3.20.0180.00917.05
8.3.10.0330.00417.30
8.3.00.0250.00417.10
8.2.250.0280.01216.52
8.2.240.0160.01316.26
8.2.230.0240.00316.36
8.2.220.0110.00716.46
8.2.210.0150.00416.18
8.2.200.0180.00016.18
8.2.190.0140.00416.21
8.2.180.0140.00416.62
8.2.170.0130.00617.62
8.2.160.0060.01717.36
8.2.150.0250.01117.14
8.2.140.0330.00917.28
8.2.130.0210.00717.45
8.2.120.0190.01317.42
8.2.110.0170.00717.45
8.2.100.0160.00417.17
8.2.90.0110.00717.68
8.2.80.0110.00817.33
8.2.70.0150.00417.49
8.2.60.0180.00017.28
8.2.50.0120.00917.33
8.2.40.0270.00417.27
8.2.30.0360.00717.25
8.2.20.0240.00717.45
8.2.10.0230.01217.29
8.2.00.0230.00717.37
8.1.300.0360.00416.18
8.1.290.0310.00816.18
8.1.280.0340.00416.18
8.1.270.0370.00617.13
8.1.260.0320.01317.26
8.1.250.0260.00017.22
8.1.240.0210.01116.89
8.1.230.0110.00617.26
8.1.220.0120.00417.20
8.1.210.0130.00316.84
8.1.200.0140.00317.11
8.1.190.0220.00917.08
8.1.180.0290.00716.99
8.1.170.0330.00316.90
8.1.160.0280.00817.00
8.1.150.0310.00617.04
8.1.140.0270.00917.04
8.1.130.0290.00417.20
8.1.120.0220.00717.26
8.1.110.0230.00617.18
8.1.100.0260.00417.15
8.1.90.0280.00317.04
8.1.80.0270.00917.25
8.1.70.0260.01117.21
8.1.60.0300.01017.40
8.1.50.0490.00717.27
8.1.40.0290.00817.07
8.1.30.0250.01117.32
8.1.20.0300.01217.42
8.1.10.0330.00717.23
8.1.00.0400.00417.20

preferences:
26.66 ms | 403 KiB | 5 Q