3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Math { const pi = 3.14; } class CircleMath extends Math { public static function calculateArea($radius) { return parent::pi * pow($radius, 2); } } class Circle { private $radius = 1.0; private $color = 'white'; private $coordinates = array('x' => 0, 'y' => 0); public function __construct() { $args = func_get_args(); for ($args as $arg) { if (is_numeric($arg)) { $this->radius = doubleval($arg); } else if (is_string($arg)) { $this->color = $arg; } else if (is_array()) { $this->coordinates = $arg; } } } public function calculateArea() { return CircleMath::calculateArea($this->radius); } public function get_radius() { return $this->radius; } public function get_color() { return $this->color; } public function get_coordinates() { return $this->coordinates; } } $className = 'Circle'; $circle = new $className(); print sprintf('The area of %s circle with radius %s and center positioned in (%s, %s) is: %s', $circle->get_color(), $circle->get_radius(), $circle->get_coordinates()['x'], $circle->get_coordinates()['y'], $circle->calculateArea()); ?>

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)
5.4.210.1700.03319.22
5.4.200.1830.04318.94
5.4.190.1900.03719.21
5.4.180.1870.04018.86
5.4.170.1930.04019.21
5.4.160.1600.03719.11
5.4.150.1970.03719.29
5.4.140.1830.03716.39
5.4.130.1730.03716.38
5.4.120.1930.03716.55
5.4.110.1700.04316.61
5.4.100.1770.04316.63
5.4.90.1900.04016.26
5.4.80.1870.03716.58
5.4.70.1830.04016.59
5.4.60.1800.04316.53
5.4.50.1830.03716.43
5.4.40.1870.04016.53
5.4.30.1870.03016.23
5.4.20.1870.04316.53
5.4.10.1670.03716.55
5.4.00.1670.03315.93
5.3.270.1800.04314.59
5.3.260.1800.04714.52
5.3.250.1670.04014.69
5.3.240.1900.04314.63
5.3.230.1830.04314.82
5.3.220.1870.04314.72
5.3.210.1800.03714.57
5.3.200.1870.04714.59
5.3.190.1900.04314.66
5.3.180.1630.04014.79
5.3.170.1900.04014.56
5.3.160.1670.03714.49
5.3.150.1870.02714.49
5.3.140.1700.03714.64
5.3.130.1870.03314.52
5.3.120.1800.03714.63
5.3.110.1730.03314.53
5.3.100.1730.03013.95
5.3.90.1930.04013.95
5.3.80.1730.03014.07
5.3.70.1670.03713.95
5.3.60.1800.03713.91
5.3.50.1630.03714.18
5.3.40.1770.02713.96
5.3.30.1630.03713.82
5.3.20.1700.03313.70
5.3.10.1670.03013.81
5.3.00.1870.04313.72

preferences:
142.54 ms | 1394 KiB | 7 Q