3v4l.org

run code in 300+ PHP versions simultaneously
<?php // cet exemple est issue de la documentation https://www.php.net/manual/fr/language.oop5.variance.php declare(strict_types=1); class Food {} // la classe AnimalFood hérite de Food class AnimalFood extends Food {} abstract class Animal { protected string $name; public function __construct(string $name) { $this->name = $name; } // Initialement un animal mange de la nouriture animale. public function eat(AnimalFood $food) { echo $this->name . " eats " . get_class($food); } } class Dog extends Animal { // Puisque la nouriture animale est avant tout de la nouriture, alors il est possible d'élargir le choix // en précisant juste nouriture. C'est toujours valide :) Le chien ne s'en plaindra pas. // Par contre un poisson... ne mangera probablement pas une côte de boeuf... // Il faut pouvoir conserver le comportement original, et garantir la nouriture appropriée. // Ceci s'appelle la contravariance. public function eat(Food $food) { echo $this->name . " eats " . get_class($food); } }

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.10.0070.00417.69
8.3.140.0090.00920.94
8.3.130.0120.00417.41
8.3.120.0100.00317.79
8.3.110.0040.00617.29
8.3.100.0150.00528.89
8.3.90.0160.00619.96
8.3.80.0180.00617.37
8.3.70.0210.00316.44
8.3.60.0170.00716.97
8.3.50.0110.00816.89
8.3.40.0160.00718.83
8.3.30.0150.00517.48
8.3.20.0150.00621.84
8.3.10.0140.00621.95
8.3.00.0130.00822.10
8.2.250.0040.01116.36
8.2.240.0070.00416.72
8.2.230.0070.00418.56
8.2.220.0090.00726.93
8.2.210.0150.00419.81
8.2.200.0160.00416.34
8.2.190.0180.00616.48
8.2.180.0190.00618.86
8.2.170.0200.00517.69
8.2.160.0160.00718.78
8.2.150.0160.00522.12
8.2.140.0150.00422.01
8.2.130.0100.00522.12
8.2.120.0090.00721.39
8.2.110.0140.00621.40
8.2.100.0110.01020.89
8.2.90.0180.00620.19
8.2.80.0120.00621.10
8.2.70.0110.00532.19
8.2.60.0080.00720.50
8.2.50.0100.00720.21
8.2.40.0130.00620.65
8.2.30.0090.00519.56
8.2.20.0110.00419.84
8.2.10.0090.00619.46
8.2.00.0110.00519.71
8.1.300.0090.00616.18
8.1.290.0150.00520.96
8.1.280.0150.01018.63
8.1.270.0140.00721.89
8.1.260.0170.00322.08
8.1.250.0150.00622.32
8.1.240.0170.00720.69
8.1.230.0180.00421.20
8.1.220.0100.00820.76
8.1.210.0130.00620.87
8.1.200.0160.00520.20
8.1.190.0140.00520.10
8.1.180.0140.00720.28
8.1.170.0140.00520.27
8.1.160.0120.00619.89
8.1.150.0120.00419.66
8.1.140.0130.00419.58
8.1.130.0100.00719.61
8.1.120.0090.00719.43
8.1.110.0100.00519.05
8.1.100.0110.00419.20
8.1.90.0100.00418.88
8.1.80.0100.00518.66
8.1.70.0090.00618.59
8.1.60.0100.00618.77
8.1.50.0110.00518.87
8.1.40.0100.00718.91
8.1.30.0110.00618.77
8.1.20.0120.00518.83
8.1.10.0110.00418.72
8.1.00.0100.00618.75
8.0.300.0120.00720.23
8.0.290.0160.00619.94
8.0.280.0160.00519.60
8.0.270.0120.00619.24
8.0.260.0120.00719.21
8.0.250.0120.00418.97
8.0.240.0120.00418.68
8.0.230.0140.00418.78
8.0.220.0140.00518.77
8.0.210.0140.00518.56
8.0.200.0130.00418.57
8.0.190.0130.00618.47
8.0.180.0110.00618.48
8.0.170.0140.00518.54
8.0.160.0120.00518.58
8.0.150.0120.00618.43
8.0.140.0130.00518.55
8.0.130.0110.00517.52
8.0.120.0130.00518.31
8.0.110.0120.00518.35
8.0.100.0110.00517.98
8.0.90.0120.00417.97
8.0.80.0110.00518.11
8.0.70.0110.00418.19
8.0.60.0120.00518.19
8.0.50.0130.00518.20
8.0.30.0110.00618.22
8.0.20.0110.00618.24
8.0.10.0140.00418.25
8.0.00.0100.00517.84
7.4.330.0110.00317.82
7.4.320.0150.00418.52
7.4.300.0140.00418.28
7.4.290.0140.00618.26
7.4.280.0170.00318.24
7.4.270.0140.00518.26
7.4.260.0140.00518.18
7.4.250.0160.00418.13
7.4.240.0130.00518.16
7.4.230.0100.00617.83
7.4.220.0110.00517.92
7.4.210.0130.00418.02
7.4.200.0140.00318.01
7.4.190.0140.00418.13
7.4.180.0130.00518.13
7.4.160.0130.00518.02
7.4.150.0140.00518.00
7.4.140.0140.00517.90
7.4.130.0140.00517.91
7.4.120.0140.00417.93
7.4.110.0120.00517.89
7.4.100.0120.00517.99
7.4.90.0130.00517.96
7.4.80.0130.00417.89
7.4.70.0110.00617.89
7.4.60.0130.00417.90
7.4.50.0100.00617.84
7.4.40.0100.00617.88
7.4.30.0120.00417.92
7.4.20.0130.00417.90
7.4.10.0110.00517.87
7.4.00.0120.00517.92
7.3.330.0120.00517.58
7.3.320.0150.00417.87
7.3.310.0140.00418.06
7.3.300.0130.00517.99
7.3.290.0130.00417.86
7.3.280.0150.00417.83
7.3.270.0130.00517.87
7.3.260.0130.00417.86
7.3.250.0140.00317.85
7.3.240.0120.00617.87
7.3.230.0140.00417.81
7.3.220.0130.00517.84
7.3.210.0130.00517.81
7.3.200.0120.00517.80
7.3.190.0120.00517.84
7.3.180.0130.00517.82
7.3.170.0120.00717.82
7.3.160.0130.00617.83
7.3.150.0140.00417.81
7.3.140.0140.00417.81
7.3.130.0130.00517.82
7.3.120.0120.00617.91
7.3.110.0140.00417.78
7.3.100.0140.00417.79
7.3.90.0140.00517.98
7.3.80.0150.00417.83
7.3.70.0140.00417.84
7.3.60.0120.00517.98
7.3.50.0140.00517.87
7.3.40.0130.00517.86
7.3.30.0120.00617.86
7.3.20.0160.00418.69
7.3.10.0160.00418.63
7.3.00.0140.00418.66

preferences:
54.16 ms | 403 KiB | 5 Q