3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "?announce=[-tg-station] thingy opened fart&key=this_is_a_test_key"; $port = 7812; $addr = 94.21.30.22; // All queries must begin with a question mark (ie "?players") if($str{0} != '?') $str = ('?' . $str); /* --- Prepare a packet to send to the server (based on a reverse-engineered packet structure) --- */ $query = "\x00\x83" . pack('n', strlen($str) + 6) . "\x00\x00\x00\x00\x00" . $str . "\x00"; /* --- Create a socket and connect it to the server --- */ $server = socket_create(AF_INET,SOCK_STREAM,SOL_TCP) or die('Unable to create export socket.'); if(!socket_connect($server,$addr,$port)) { return "ERROR"; } /* --- Send bytes to the server. Loop until all bytes have been sent --- */ $bytestosend = strlen($query); $bytessent = 0; while ($bytessent < $bytestosend) { //echo $bytessent.'<br>'; $result = socket_write($server,substr($query,$bytessent),$bytestosend-$bytessent); //echo 'Sent '.$result.' bytes<br>'; if ($result===FALSE) die(socket_strerror(socket_last_error())); $bytessent += $result; } /* --- Idle for a while until recieved bytes from game server --- */ $result = socket_read($server, 10000, PHP_BINARY_READ); socket_close($server); // we don't need this anymore ?>

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.270.0000.07018.96
5.4.260.0200.04718.95
5.4.250.0070.07718.80
5.4.240.0070.08318.65
5.4.230.0230.06718.66
5.4.220.0170.06018.75
5.4.210.0270.06318.79
5.4.200.0030.08018.96
5.4.190.0200.04018.94
5.4.180.0230.06019.00
5.4.170.0100.05719.00
5.4.160.0170.06318.78
5.4.150.0030.08319.08
5.4.140.0100.05016.37
5.4.130.0100.04716.29
5.4.120.0100.04716.36
5.4.110.0000.07716.65
5.4.100.0170.07016.41
5.4.90.0270.05016.47
5.4.80.0100.05016.61
5.4.70.0070.05716.54
5.4.60.0100.06016.49
5.4.50.0200.05716.48
5.4.40.0200.05316.60
5.4.30.0030.08016.56
5.4.20.0100.04316.46
5.4.10.0000.08016.54
5.4.00.0200.05715.89
5.3.280.0070.07314.59
5.3.270.0070.07714.63
5.3.260.0030.06314.45
5.3.250.0170.06014.62
5.3.240.0030.05714.61
5.3.230.0030.08014.60
5.3.220.0200.05014.48
5.3.210.0100.07714.42
5.3.200.0070.07314.57
5.3.190.0070.05714.29
5.3.180.0070.05314.43
5.3.170.0100.07314.58
5.3.160.0170.06314.45
5.3.150.0130.07014.48
5.3.140.0170.04714.42
5.3.130.0130.05314.43
5.3.120.0100.05314.55
5.3.110.0130.05014.55
5.3.100.0170.04313.73
5.3.90.0130.06313.87
5.3.80.0200.05714.04
5.3.70.0070.06314.02
5.3.60.0030.05014.02
5.3.50.0100.05313.86
5.3.40.0170.06013.86
5.3.30.0130.05013.77
5.3.20.0230.05013.61
5.3.10.0100.06313.80
5.3.00.0170.05013.70
5.2.170.0000.05011.25
5.2.160.0130.05310.91
5.2.150.0070.06311.00
5.2.140.0030.04711.25
5.2.130.0030.05011.08
5.2.120.0030.05710.86
5.2.110.0130.03311.02
5.2.100.0170.03311.03
5.2.90.0070.04711.00
5.2.80.0070.04711.02
5.2.70.0000.05311.09
5.2.60.0000.06010.94
5.2.50.0030.04711.14
5.2.40.0100.05011.04
5.2.30.0000.05310.89
5.2.20.0070.05710.97
5.2.10.0070.05011.02
5.2.00.0100.04710.70
5.1.60.0100.03010.23
5.1.50.0070.0309.79
5.1.40.0100.03010.17
5.1.30.0030.04010.22
5.1.20.0000.05710.43
5.1.10.0070.03310.30
5.1.00.0070.0339.98
5.0.50.0030.0308.78
5.0.40.0100.0238.47
5.0.30.0000.0638.26
5.0.20.0070.0238.27
5.0.10.0070.0308.41
5.0.00.0000.0578.30
4.4.90.0000.0236.23
4.4.80.0100.0236.23
4.4.70.0030.0236.23
4.4.60.0070.0206.23
4.4.50.0170.0236.23
4.4.40.0100.0376.23
4.4.30.0030.0236.23
4.4.20.0070.0276.23
4.4.10.0070.0176.23
4.4.00.0070.0336.23
4.3.110.0030.0206.23
4.3.100.0070.0276.23
4.3.90.0070.0206.23
4.3.80.0070.0306.23
4.3.70.0000.0306.23
4.3.60.0030.0206.23
4.3.50.0000.0236.23
4.3.40.0070.0406.23
4.3.30.0070.0236.23
4.3.20.0030.0336.23
4.3.10.0000.0276.23
4.3.00.0170.0236.36

preferences:
155.79 ms | 1394 KiB | 7 Q