3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testString = 'scary ghost'; echo "She saw a $testString. It was green!" . PHP_EOL; //embed newline with /n echo "She saw a $testString. It was blue!\n"; $fruit = array('apple', 'banana', 'orange', 'grape'); echo "I ate one $fruit[0] for breakfast, and one $fruit[2] for lunch\n"; // Interpolating an array with a string constant key $name = array('first' => 'George', 'last' => 'Washington'); // Syntax error //echo "The first US President was $name['first'] $name['last']\n"; // Using complex syntax echo "The first US President was {$name['first']} {$name['last']}\n"; $linkData = array('url' =>'http://www.phpfreaks.com', 'name' => 'phpFreaks'); $linkConcatenate = '<a href="' . $linkData['url'] . "'>" . $linkData['name'] . '</a>' . PHP_EOL; $linkInterpolate = "<a href='{$linkData['url']}'>{$linkData['name']}</a>\n"; echo "PHP questions answered at $linkConcatenate <br>\n"; echo "PHP questions answered at $linkInterpolate <br>\n"; class Person { private $name; private $age; private $title; public $summary; public function __construct($name, $title, $age) { $this->name = $name; $this->age = $age; $this->title = $title; $this->summary = $this->__tostring(); } public function __tostring() { return "Name: {$this->name}. Age: {$this->age}. Title: {$this->title}"; } public function getName() { return $this->name; } public function getAge() { return $this->age; } } $bob = new Person('Bob Smith', 'Manager', 31); $sue = new Person('Sue Jones', 'Director', 28); echo "Bob's Summary| {$bob->summary}\n"; echo "Sue's Summary| {$sue->summary}\n"; echo " <table> <tr><th>Employee</th></tr> <tr><td>$bob</td></tr> <tr><td>$sue</td></tr> </table>"; $employees[] = $bob; $employees[] = $sue; echo "\n\n\n"; foreach ($employees as $employee) { echo "{$employee->getName()} is {$employee->getAge()} years old\n"; }

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.60.0100.01316.63
8.3.50.0100.01019.63
8.3.40.0000.01420.25
8.3.30.0080.00818.85
8.3.20.0000.00824.18
8.3.10.0050.00324.66
8.3.00.0050.00226.16
8.2.180.0090.00625.92
8.2.170.0100.01018.95
8.2.160.0050.00822.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00819.97
8.2.110.0030.00620.96
8.2.100.0120.00017.59
8.2.90.0060.00319.98
8.2.80.0040.00420.65
8.2.70.0030.00617.63
8.2.60.0080.00018.00
8.2.50.0030.00518.07
8.2.40.0030.00518.28
8.2.30.0040.00418.23
8.2.20.0050.00319.44
8.2.10.0020.00519.02
8.2.00.0040.00419.33
8.1.280.0130.00725.92
8.1.270.0000.00723.99
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0080.00022.19
8.1.230.0120.00020.96
8.1.220.0060.00317.79
8.1.210.0030.00618.88
8.1.200.0000.00817.36
8.1.190.0000.00817.35
8.1.180.0000.00918.10
8.1.170.0040.00418.48
8.1.160.0000.00818.84
8.1.150.0040.00418.67
8.1.140.0030.00517.46
8.1.130.0070.00018.79
8.1.120.0000.00717.43
8.1.110.0000.00817.50
8.1.100.0050.00317.32
8.1.90.0000.00817.50
8.1.80.0070.00317.38
8.1.70.0030.00317.49
8.1.60.0000.00817.64
8.1.50.0030.00617.59
8.1.40.0040.00417.55
8.1.30.0000.00817.73
8.1.20.0050.00317.70
8.1.10.0110.00017.57
8.1.00.0000.00817.55
8.0.300.0070.00020.13
8.0.290.0060.00316.63
8.0.280.0030.00518.47
8.0.270.0050.00316.82
8.0.260.0000.00718.50
8.0.250.0030.00316.89
8.0.240.0000.00616.99
8.0.230.0000.00716.97
8.0.220.0050.00316.93
8.0.210.0030.00316.84
8.0.200.0070.00016.95
8.0.190.0040.00416.88
8.0.180.0040.00416.94
8.0.170.0050.00316.95
8.0.160.0030.00516.93
8.0.150.0020.00516.88
8.0.140.0000.00916.72
8.0.130.0000.00713.23
8.0.120.0040.00416.85
8.0.110.0050.00316.88
8.0.100.0000.00816.89
8.0.90.0040.00416.99
8.0.80.0050.00216.94
8.0.70.0050.00316.89
8.0.60.0040.00416.84
8.0.50.0000.00816.86
8.0.30.0040.00416.92
8.0.20.0000.00816.99
8.0.10.0000.00817.10
8.0.00.0040.00416.98
7.4.330.0000.00515.55
7.4.320.0000.00616.63
7.4.300.0060.00016.66
7.4.290.0040.00416.51
7.4.280.0000.00816.62
7.4.270.0040.00416.60
7.4.260.0030.00313.32
7.4.250.0000.00716.61
7.4.240.0030.00516.53
7.4.230.0030.00316.63
7.4.220.0000.00816.62
7.4.210.0070.00016.43
7.4.200.0000.00716.61
7.4.190.0000.00816.68
7.4.180.0000.00716.53
7.4.160.0040.00416.54
7.4.150.0040.00416.62
7.4.140.0000.00816.50
7.4.130.0000.00816.55
7.4.120.0000.00816.52
7.4.110.0030.00316.52
7.4.100.0040.00416.49
7.4.90.0070.00016.59
7.4.80.0070.00016.50
7.4.70.0040.00416.50
7.4.60.0040.00416.58
7.4.50.0070.00016.32
7.4.40.0040.00416.32
7.4.30.0030.00516.43
7.4.20.0050.00316.47
7.4.10.0040.00416.42
7.4.00.0050.00216.57
7.3.330.0040.00416.31
7.3.320.0050.00013.41
7.3.310.0040.00416.50
7.3.300.0050.00216.29
7.3.290.0030.00316.43
7.3.280.0040.00416.29
7.3.270.0000.00716.29
7.3.260.0000.00716.41
7.3.250.0000.00716.45
7.3.240.0040.00416.37
7.3.230.0040.00416.41
7.3.220.0030.00316.39
7.3.210.0000.00816.16
7.3.200.0040.00416.18
7.3.190.0060.00316.24
7.3.180.0000.00916.29
7.3.170.0070.00016.42
7.3.160.0020.00516.24
7.3.150.0020.00516.19
7.3.140.0040.00416.35
7.3.130.0040.00416.33
7.3.120.0000.00716.40
7.3.110.0050.00316.17
7.3.100.0040.00416.18
7.3.90.0080.00016.68
7.3.80.0070.00016.32
7.3.70.0050.00316.40
7.3.60.0000.00716.49
7.3.50.0080.00016.34
7.3.40.0080.00016.41
7.3.30.0090.00016.32
7.3.20.0030.00616.38
7.3.10.0000.00816.50
7.3.00.0060.00316.54

preferences:
33.27 ms | 400 KiB | 5 Q