3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('FIELDS', ['name', 'address', 'city']); define( 'HTML_FIELD_FORM', <<<'HTML' <h2>%1$s</h2> <form method="post" autocomplete="off"> <input type="text" name="%1$s" autocomplete="off" placeholder="%1$s"><br> <input value="submit" type="submit"> </form> HTML ); define( 'HTML_CLEAR_FORM', <<<'HTML' <form method="post" autocomplete="off"> <input type="text" name="%1$s" value="1" hidden><br> <input value="%1$s" type="submit"> </form> HTML ); foreach (FIELDS as $field) { if (isset($_POST[$field])) { // Set session & cookie from post $_SESSION[$field] = $_POST[$field]; setcookie($field, $_POST[$field]); } elseif (isset($_COOKIE[$field])) { // Set session from cookie $_SESSION[$field] = $_COOKIE[$field]; } elseif (!isset($_SESSION[$field])) { // Present individual field form printf(HTML_FIELD_FORM, $field); } } foreach (['clear_session', 'clear_cookies'] as $action) { printf(HTML_CLEAR_FORM, $action); }

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.0140.00316.63
8.3.50.0140.00716.55
8.3.40.0090.00920.07
8.3.30.0220.00018.54
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.180.0130.00718.29
8.2.170.0180.00418.79
8.2.160.0100.00322.96
8.2.150.0070.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0030.00521.08
8.2.110.0070.00319.21
8.2.100.0110.00718.22
8.2.90.0210.00418.26
8.2.80.0190.00518.64
8.2.70.0170.00442.63
8.2.60.0250.00518.09
8.2.50.0170.00518.62
8.2.40.0140.00519.34
8.2.30.0140.00518.60
8.2.20.0100.00618.91
8.2.10.0150.00518.61
8.2.00.0130.00618.59
8.1.280.0090.00925.92
8.1.270.0100.00823.31
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00322.18
8.1.230.0170.00519.28
8.1.220.0150.00418.21
8.1.210.0200.00118.58
8.1.200.0170.00318.00
8.1.190.0130.00818.04
8.1.180.0150.00518.62
8.1.170.0150.00418.35
8.1.160.0150.00718.85
8.1.150.0180.00418.76
8.1.140.0110.00818.87
8.1.130.0170.00418.87
8.1.120.0170.00418.49
8.1.110.0150.00518.47
8.1.100.0170.00318.51
8.1.90.0160.00518.45
8.1.80.0160.00518.52
8.1.70.0170.00418.50
8.1.60.0180.00418.49
8.1.50.0170.00418.48
8.1.40.0160.00518.53
8.1.30.0190.00318.53
8.1.20.0170.00318.54
8.1.10.0160.00618.51
8.1.00.0180.00318.50
8.0.300.0160.00418.99
8.0.290.0220.00217.92
8.0.280.0180.00618.71
8.0.270.0150.00618.22
8.0.260.0190.00218.24
8.0.250.0140.00618.31
8.0.240.0160.00518.29
8.0.230.0160.00518.27
8.0.220.0170.00518.22
8.0.210.0170.00318.24
8.0.200.0160.00518.26
8.0.190.0170.00418.28
8.0.180.0120.00818.62
8.0.170.0150.00418.29
8.0.160.0140.00718.27
8.0.150.0140.00418.26
8.0.140.0140.00718.26
8.0.130.0150.00318.27
8.0.120.0150.00618.26
8.0.110.0160.00518.24
8.0.100.0150.00518.25
8.0.90.0140.00518.24
8.0.80.0150.00418.24
8.0.70.0130.00718.27
8.0.60.0160.00518.23
8.0.50.0150.00518.25
8.0.30.0160.00518.26
8.0.20.0170.00318.29
8.0.10.0130.00818.29

preferences:
42.85 ms | 400 KiB | 5 Q