3v4l.org

run code in 300+ PHP versions simultaneously
<?php require("php_serial.class.php"); if (isset($_GET['action'])) { $serial = new phpSerial; $serial->deviceSet("/dev/ttyACM0"); $serial->confBaudRate(115200); $serial->deviceOpen(); if ($_GET['action'] == "greenon") { $serial->sendMessage("0"); $done = false; $line = ""; while (!$done) { $read = $serial->readPort(); for ($i = 0; $i < strlen($read); $i++) { if ($read[$i] == "\n") { $done = true; echo "Response from Arduino: ".$line."\n"; $line = ""; } else { $line .= $read[$i]; } } } } else if ($_GET['action'] == "greenoff") { $serial->sendMessage("1\r"); } else if ($_GET['action'] == "redon") { $serial->sendMessage("2\r"); $read = $serial->readPort(); echo $read; } else if ($_GET['action'] == "redoff") { $serial->sendMessage("3\r"); } $serial->deviceClose(); } ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Arduino Project 1: Serial LED Control</title> </head> <body> <h1>Arduino Project 1: Serial LED Control</h1> <p><a href="<?=$_SERVER['PHP_SELF'] . "?action=greenon" ?>"> Click here to turn pin13 on.</a></p> <p><a href="<?=$_SERVER['PHP_SELF'] . "?action=greenoff" ?>"> Click here to turn pin13 off.</a></p> <p><a href="<?=$_SERVER['PHP_SELF'] . "?action=redon" ?>"> Click here to turn the RED LED on.</a></p> <p><a href="<?=$_SERVER['PHP_SELF'] . "?action=redoff" ?>"> Click here to turn the RED LED off.</a></p> </body> </html>

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.0040.01116.61
8.3.50.0090.01121.88
8.3.40.0070.00718.93
8.3.30.0070.00718.82
8.3.20.0000.00720.16
8.3.10.0040.00423.56
8.3.00.0080.00019.85
8.2.180.0150.00016.63
8.2.170.0140.00022.96
8.2.160.0040.01120.52
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0080.00019.39
8.2.120.0040.00426.35
8.2.110.0090.00022.06
8.2.100.0080.00418.03
8.2.90.0070.00019.26
8.2.80.0000.00817.97
8.2.70.0080.00017.63
8.2.60.0100.00317.80
8.2.50.0080.00018.07
8.2.40.0080.00022.15
8.2.30.0070.00020.74
8.2.20.0000.00717.87
8.2.10.0040.00418.24
8.2.00.0000.00717.98
8.1.280.0140.00425.92
8.1.270.0180.00020.45
8.1.260.0030.00528.09
8.1.250.0080.00028.09
8.1.240.0040.00423.92
8.1.230.0090.00317.76
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0060.00317.25
8.1.190.0000.00817.24
8.1.180.0040.00418.10
8.1.170.0090.00018.63
8.1.160.0040.00420.63
8.1.150.0020.00518.88
8.1.140.0060.00319.46
8.1.130.0040.00417.69
8.1.120.0080.00017.45
8.1.110.0070.00017.45
8.1.100.0080.00017.42
8.1.90.0000.00717.52
8.1.80.0040.00417.42
8.1.70.0030.00317.24
8.1.60.0040.00417.64
8.1.50.0000.00817.60
8.1.40.0080.00017.46
8.1.30.0060.00317.70
8.1.20.0030.00517.71
8.1.10.0000.00717.61
8.1.00.0030.00617.57
8.0.300.0040.00418.77
8.0.290.0000.00816.88
8.0.280.0070.00018.56
8.0.270.0040.00417.39
8.0.260.0030.00517.29
8.0.250.0030.00317.02
8.0.240.0090.00017.18
8.0.230.0040.00417.04
8.0.220.0070.00017.04
8.0.210.0040.00417.11
8.0.200.0030.00317.15
8.0.190.0080.00317.11
8.0.180.0040.00417.05
8.0.170.0030.00617.00
8.0.160.0040.00416.97
8.0.150.0030.00517.08
8.0.140.0070.00016.94
8.0.130.0030.00313.45
8.0.120.0030.00617.02
8.0.110.0040.00417.12
8.0.100.0070.00017.05
8.0.90.0070.00017.03
8.0.80.0070.00717.07
8.0.70.0000.00817.09
8.0.60.0000.00716.96
8.0.50.0040.00416.99
8.0.30.0050.01317.31
8.0.20.0090.00917.40
8.0.10.0040.00417.10
8.0.00.0080.01016.87
7.4.330.0030.00316.73
7.4.320.0000.00616.57
7.4.300.0000.00816.55
7.4.290.0000.00716.66
7.4.280.0000.00716.68
7.4.270.0050.00316.70
7.4.260.0000.00816.45
7.4.250.0000.00716.63
7.4.240.0040.00416.61
7.4.230.0070.00016.47
7.4.220.0160.00816.61
7.4.210.0050.01016.67
7.4.200.0040.00416.66
7.4.160.0130.00316.41
7.4.150.0040.01317.40
7.4.140.0080.01117.86
7.4.130.0070.01116.41
7.4.120.0110.00716.60
7.4.110.0060.01216.54
7.4.100.0080.01616.69
7.4.90.0070.01016.42
7.4.80.0130.00719.39
7.4.70.0030.01616.62
7.4.60.0060.01016.65
7.4.50.0060.00616.71
7.4.40.0030.01316.51
7.4.30.0130.00916.61
7.4.00.0060.01014.90
7.3.330.0000.00513.15
7.3.320.0040.00413.23
7.3.310.0030.00316.14
7.3.300.0000.00716.32
7.3.290.0000.00716.26
7.3.280.0040.01316.35
7.3.270.0090.00917.40
7.3.260.0070.01416.30
7.3.250.0100.01116.37
7.3.240.0100.01016.32
7.3.230.0090.00916.44
7.3.210.0090.01516.30
7.3.200.0090.00616.39
7.3.190.0080.00816.40
7.3.180.0130.00316.36
7.3.170.0070.01016.46
7.3.160.0150.00716.41
7.3.120.0070.01014.61
7.3.110.0110.00714.83
7.3.100.0060.00915.08
7.3.90.0100.00615.02
7.3.80.0100.00714.84
7.3.70.0090.00614.57
7.3.60.0040.01114.88
7.3.50.0040.01114.88
7.3.40.0040.01114.75
7.3.30.0060.00914.77
7.3.20.0060.01116.46
7.3.10.0070.00716.63
7.3.00.0070.00716.68
7.2.330.0120.00616.56
7.2.320.0130.00616.58
7.2.310.0160.00316.56
7.2.300.0140.00416.66
7.2.290.0100.00616.46
7.2.250.0100.01014.82
7.2.240.0030.01615.12
7.2.230.0110.00715.18
7.2.220.0140.00314.94
7.2.210.0070.00714.99
7.2.200.0050.00514.71
7.2.190.0030.01114.88
7.2.180.0060.00915.02
7.2.170.0040.01515.04
7.2.60.0070.01016.75
7.2.00.0120.00418.94
7.1.330.0080.00415.62
7.1.320.0080.00815.73
7.1.310.0100.00615.28
7.1.300.0030.01415.69
7.1.290.0000.01315.47
7.1.280.0030.00715.57
7.1.270.0060.00615.72
7.1.260.0120.00315.72
7.1.200.0130.00015.32
7.1.100.0000.01518.07
7.1.70.0060.00616.91
7.1.60.0120.01219.52
7.1.50.0100.01016.54
7.1.00.0000.07722.52
7.0.200.0050.00516.56
7.0.60.0100.08019.82
7.0.50.0100.03317.86
7.0.40.0130.06720.13
7.0.30.0400.06720.10
7.0.20.0370.07320.00
7.0.10.0070.05720.19
7.0.00.0030.04720.05
5.6.280.0030.05321.12
5.6.210.0200.07020.68
5.6.200.0030.07718.20
5.6.190.0070.05320.79
5.6.180.0170.04320.61
5.6.170.0330.07020.46
5.6.160.0000.08720.43
5.6.150.0030.04718.17
5.6.140.0070.05018.09
5.6.130.0100.05318.15
5.6.120.0200.07021.13
5.6.110.0170.08721.12
5.6.100.0070.07021.12
5.6.90.0100.07320.98
5.6.80.0130.06020.39
5.5.350.0170.07720.40
5.5.340.0070.04318.02
5.5.330.0000.04720.13
5.5.320.0330.08020.22
5.5.310.0300.05720.27
5.5.300.0030.07717.93
5.5.290.0030.08317.99
5.5.280.0030.04020.69
5.5.270.0100.08720.85
5.5.260.0000.06720.77
5.5.250.0100.07020.72
5.5.240.0100.03320.27
5.4.450.0930.05019.50
5.4.440.0100.05719.63
5.4.430.0930.05019.29
5.4.420.1000.04319.29
5.4.410.0900.05019.28
5.4.400.0830.05319.13
5.4.390.0700.06018.97
5.4.380.0700.05019.21
5.4.370.0830.05719.30
5.4.360.0930.05319.17
5.4.350.1230.06019.16
5.4.340.0700.05319.41
5.4.320.1100.05019.24
5.4.310.1130.05719.30
5.4.300.1200.06019.20
5.4.290.0730.04718.77
5.4.280.0800.06018.94
5.4.270.0830.05719.13
5.4.260.0630.06018.81
5.4.250.0700.05019.12
5.4.240.0600.05719.08
5.4.230.0730.04719.22
5.4.220.0700.05319.20
5.4.210.0730.04718.93
5.4.200.0730.05018.90
5.4.190.0870.04718.79
5.4.180.0900.07019.29
5.4.170.0600.06719.11
5.4.160.0900.04719.06
5.4.150.1200.07019.37
5.4.140.0870.05316.24
5.4.130.0900.04716.40
5.4.120.1030.04716.40
5.4.110.0730.04316.49
5.4.100.0700.04716.54
5.4.90.0730.04716.06
5.4.80.0800.04016.47
5.4.70.0670.05316.05
5.4.60.0770.04716.46
5.4.50.1300.06016.42
5.4.40.0700.05016.51
5.4.30.0730.05316.53
5.4.20.0630.06316.19
5.4.10.0230.03716.49
5.4.00.0100.04715.85
5.3.290.1000.07014.53
5.3.280.0630.05714.71
5.3.270.0870.05314.49
5.3.260.0930.04714.65
5.3.250.0700.04714.47
5.3.240.0730.05314.46
5.3.230.1200.06714.41
5.3.220.1030.05014.52
5.3.210.0700.05014.42
5.3.200.0730.04714.68
5.3.190.1500.08014.52
5.3.180.0970.06014.42
5.3.170.0670.05714.57
5.3.160.0830.04314.43
5.3.150.0830.05714.62
5.3.140.1100.03714.61
5.3.130.0670.05714.36
5.3.120.0770.05314.50
5.3.110.0130.05014.44
5.3.100.0500.05314.00
5.3.90.0570.05014.12
5.3.80.0600.05314.07
5.3.70.0670.05014.13
5.3.60.0630.04713.85
5.3.50.0630.05713.91
5.3.40.0630.04713.99
5.3.30.0630.04013.77
5.3.20.0600.05013.69
5.3.10.0730.04313.46
5.3.00.0500.05713.50
5.2.170.0430.04010.96
5.2.160.0470.04011.12
5.2.150.0430.04011.01
5.2.140.0430.04011.00
5.2.130.0400.04711.18
5.2.120.0430.03711.07
5.2.110.0600.04310.91
5.2.100.0400.04011.05
5.2.90.0400.04311.06
5.2.80.0470.04010.97
5.2.70.0530.03311.21
5.2.60.0330.04711.06
5.2.50.0600.05310.84
5.2.40.0370.03710.85
5.2.30.0530.03010.93
5.2.20.0130.04710.82
5.2.10.0100.05010.84
5.2.00.0500.04010.65
5.1.60.0300.03710.02
5.1.50.0430.03310.03
5.1.40.0070.0379.85
5.1.30.0070.04010.39
5.1.20.0070.03710.38
5.1.10.0100.03310.02
5.1.00.0500.0339.97
5.0.50.0070.0278.63
5.0.40.0200.0238.28
5.0.30.0230.0438.13
5.0.20.0230.0338.30
5.0.10.0370.0278.12
5.0.00.0270.0408.07
4.4.90.0130.0275.96
4.4.80.0170.0235.96
4.4.70.0000.0235.96
4.4.60.0000.0235.96
4.4.50.0030.0235.96
4.4.40.0230.0335.96
4.4.30.0030.0205.96
4.4.20.0030.0205.96
4.4.10.0100.0205.96
4.4.00.0170.0375.96
4.3.110.0230.0205.96
4.3.100.0230.0175.96
4.3.90.0170.0205.96
4.3.80.0170.0335.96
4.3.70.0370.0175.96
4.3.60.0130.0235.96
4.3.50.0200.0205.96
4.3.40.0270.0305.96
4.3.30.0100.0205.96
4.3.20.0100.0205.96
4.3.10.0200.0205.96
4.3.00.0130.0205.96

preferences:
53.57 ms | 401 KiB | 5 Q