3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Katana { private $description = 'The katana is characterized by its distinctive appearance: a curved, single-edged blade with a circular or squared guard and long grip to accommodate two hands. Western historians have said that katana were among the finest cutting weapons in world military history.'; private $damage = 30; public function applyDamage() { $damageOutput = $this->damage; // 5% chance of a critical hit. Double the damage. $criticalHit = random_int(1, 100); if ($criticalHit < 5) { $damageOutput *= 2; } return $damageOutput; } public function description() { return $this->description; } } $weapon = new Katana; echo $weapon->applyDamage();

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)
7.3.10.0060.00616.59
7.3.00.0060.00816.71
7.2.130.0020.01016.90
7.2.120.0070.00716.79
7.2.110.0050.00716.65
7.2.100.0060.00617.03
7.2.90.0050.01016.90
7.2.80.0040.00717.10
7.2.70.0300.01116.37
7.2.60.0120.00516.31
7.2.50.0370.00716.12
7.2.40.0270.01116.24
7.2.30.0280.00516.22
7.2.20.0280.00916.16
7.2.10.0290.00816.13
7.2.00.0260.00916.22
7.1.250.0030.00915.84
7.1.170.1020.01013.68
7.1.160.0730.00713.78
7.1.150.0780.00013.76
7.1.140.0790.00713.86
7.1.130.0670.00613.78
7.1.120.0680.01013.55
7.1.110.0640.00613.73
7.1.100.0620.01013.64
7.1.90.0880.01013.91
7.1.80.0950.00313.82
7.1.70.0790.00713.96
7.1.60.1000.01331.89
7.1.50.1050.01031.75
7.1.40.1160.00631.94
7.1.30.1090.01331.80
7.1.20.1090.01331.76
7.1.10.1030.01013.80
7.1.00.0850.00313.93

preferences:
16.44 ms | 401 KiB | 5 Q