3v4l.org

run code in 300+ PHP versions simultaneously
<?php class content { public function get_header() { $returned = array(); $confdir = ($_SERVER['DOCUMENT_ROOT']. '\site\config.xml'); $xml= simplexml_load_file($confdir); $title = ($xml->site->title); $hmenu = ($xml->content->nav); $ntitle = (string)$title; $nhmenu = (string)$hmenu; $returned[] = "<div class = 'header'>"; //header start $returned[] = '<div class = "title"><h1>'. $ntitle. '</h1></div>'; $returned[] = '<div class = "login">'; $returned[] = '<form>'; $returned[] = '<p>Username: <input type = "text" name = "username" value = "'. @$_POST['username']. '"></p>'; $returned[] = '<p>Password: <input type = "text" name = "password" value = "'. @$_POST['password']. '"></p>'; $returned[] = '</form>'; $returned[] = '</div>'; //header end $returned[] = "</div>"; $returned[] = "<div class = 'nav'><div class = 'values'>"; //nav start $cslinks = (array_values(database::query('menu', $nhmenu, 'menu')[0])[0]); $exlinks = explode(',', $cslinks); $i = 0; while($i < count($exlinks)) { if($exlinks[$i] == 'home') { $returned[] = "<a href = '". explode('/', $_SERVER['REQUEST_URI'])[0]. "index.php'>". $exlinks[$i]. "</a> | "; } else if($i != count($exlinks)-1) { $returned[] = "<a href = '". explode('/', $_SERVER['REQUEST_URI'])[0]. $exlinks[$i]. ".php'>". $exlinks[$i]. "</a> | "; } else { $returned[] = "<a href = '". explode('/', $_SERVER['REQUEST_URI'])[0]. $exlinks[$i]. ".php'>". $exlinks[$i]. "</a>"; } $i++; //sorts out returning the menu contents, their respective links and their display names } //nav end $returned[] = "</div></div>"; //echo start $i = 0; while($i < count($returned)) { echo($returned[$i]); $i++; } } public function get_pcontent() { $returned = array(); $confdir = ($_SERVER['DOCUMENT_ROOT']. '\site\config.xml'); $xml= simplexml_load_file($confdir); $post_page = ($xml->pagedata->post_page); $fpost_page = (string)$post_page; $url = explode('/', $_SERVER['SCRIPT_NAME']); $curl = $url[count($url)-1]; if($curl == $fpost_page) { $content = database::query('post', '6', 'posts'); if(count($content != 0)) { $returned = $content; $ordered = self::reorder($returned); $opnum = count($ordered)-1; $i = 0; while($opnum >= $i) { $blocks = (self::construct_block($ordered[$i])); $secopnum = count($blocks)-1; $q = 0; while($secopnum >= $q) { echo($blocks[$q]); $q++; } $i++; } } else { echo('nothing found'); } } } public function reorder($vals) { $array_vals = array_values($vals); $return = array(); $opnum = count($array_vals) - 1; while($opnum >= 0) { unset($array_vals[$opnum]['id']); $return[] = $array_vals[$opnum]; $opnum--; } return(self::structure($return)); } public function structure($vals) { $opnum = count($vals)-1; $tfvals = array(); $i = 0; while($opnum >= $i) { $elements = count($vals[$i])-1; $nvals = array_values($vals[$i]); $fvals = array(); $q = 0; while($elements >= $q) { $fvals[] = $nvals[$q]; $q++; } $tfvals[] = $fvals; $i++; } return $tfvals; } public function construct_block($vals) { $post = array(); $post[] = '<div class = "post">'; $opnum = count($vals)-1; $post[] = '<h4 id = "post_'. $vals[0].'">'. $vals[0]. '</h4>'; $post[] = '<img id = "fimage" src = "'. $vals[4]. '"></img><br></br>'; $post[] = '<span id = "categories">'. $vals[1]. '</span>'; $post[] = '<h5 id = "author">'. $vals[2]. '</h5>'; $post[] = '<span id = "time">'. self::dtformat($vals[3]). '</span>'; $post[] = '<p id = "shcontent">'. $vals[5]. '</p>'; $post[] = '<p id = "lhcontent">'. $vals[6]. '</p>'; $post[] = '</div>'; return($post); } public function dtformat($datetime) { return($datetime); } public function get_rmenu() { } } class database { public function connect() { $confdir = ($_SERVER['DOCUMENT_ROOT']. '\site\config.xml'); $xml= simplexml_load_file($confdir); $host = ($xml->database->host); $user = ($xml->database->user); $pass = ($xml->database->pass); $db = ($xml->database->db); $nhost = (string)$host; $nuser = (string)$user; $npass = (string)$pass; $ndb = (string)$db; $con= mysql_connect($nhost, $nuser, $npass); if (mysql_error()) { return false; } else { if(mysql_select_db($ndb)) { return true; } else { return false; } } } public function query($type, $find, $table) { /*if(self::connect()) { if($type == "menu") { $find = preg_replace("/\s+/", "", $find); $query = "SELECT `elements` FROM `$table` WHERE `title` = '$find'"; $qres = mysql_query($query); $qnum = mysql_num_rows($qres); $fresult = array(); $i = 0; while($i < $qnum) { $fresult[] = mysql_fetch_assoc($qres); $i++; } return($fresult); } else if($type == "page") { //create page table //construct page } else if($type == "post") { $find = preg_replace("/\s+/", "", $find); $query = "SELECT * FROM `$table`"; $qres = mysql_query($query); $qnum = mysql_num_rows($qres); $fresult = array(); $i = 0; while($i < $qnum && $i < $find) { $fresult[] = mysql_fetch_assoc($qres); $i++; } return($fresult); } else if($type == "menu") { //create menu table //construct menus } else if($type == "widget") { //create widget table //construct widgets } else { return(mysql_error()); } }*/ return array(); } } ?>

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.0030.01818.43
8.3.50.0080.01021.99
8.3.40.0000.01518.71
8.3.30.0160.00018.95
8.3.20.0040.00420.23
8.3.10.0030.00621.96
8.3.00.0080.00022.52
8.2.180.0120.00316.63
8.2.170.0000.01522.96
8.2.160.0110.01118.96
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0090.00019.36
8.2.110.0090.00321.98
8.2.100.0030.00917.71
8.2.90.0080.00019.22
8.2.80.0030.00718.04
8.2.70.0030.00617.50
8.2.60.0080.00017.80
8.2.50.0030.00718.07
8.2.40.0060.00319.82
8.2.30.0070.00018.17
8.2.20.0000.00717.68
8.2.10.0040.00417.70
8.2.00.0040.00417.75
8.1.280.0100.01025.92
8.1.270.0040.00422.08
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00023.85
8.1.230.0080.00419.21
8.1.220.0030.00517.74
8.1.210.0030.00618.77
8.1.200.0060.00317.23
8.1.190.0050.00317.54
8.1.180.0050.00318.57
8.1.170.0050.00318.79
8.1.160.0040.00422.09
8.1.150.0040.00418.54
8.1.140.0070.00317.32
8.1.130.0000.00717.71
8.1.120.0000.00817.30
8.1.110.0050.00317.43
8.1.100.0000.00817.43
8.1.90.0040.00417.42
8.1.80.0050.00217.32
8.1.70.0000.00717.38
8.1.60.0090.00317.44
8.1.50.0030.00617.45
8.1.40.0000.00817.46
8.1.30.0040.00417.52
8.1.20.0040.00417.54
8.1.10.0000.00817.37
8.1.00.0050.00317.26
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0070.00018.38
8.0.270.0030.00617.13
8.0.260.0080.00016.88
8.0.250.0030.00316.79
8.0.240.0030.00316.89
8.0.230.0030.00316.82
8.0.220.0000.00816.85
8.0.210.0050.00316.85
8.0.200.0030.00516.90
8.0.190.0050.00216.89
8.0.180.0050.00216.83
8.0.170.0080.00016.75
8.0.160.0050.00316.81
8.0.150.0040.00416.85
8.0.140.0000.00716.69
8.0.130.0000.00513.24
8.0.120.0000.00816.80
8.0.110.0000.00716.73
8.0.100.0040.00416.79
8.0.90.0000.00716.64
8.0.80.0090.00616.87
8.0.70.0070.00016.80
8.0.60.0070.00016.66
8.0.50.0050.00216.96
8.0.30.0060.01617.19
8.0.20.0080.01117.40
8.0.10.0000.00716.85
8.0.00.0120.00716.54
7.4.330.0030.00315.00
7.4.320.0030.00316.46
7.4.300.0060.00016.55
7.4.290.0000.00816.50
7.4.280.0050.00216.37
7.4.270.0070.00016.47
7.4.260.0080.00016.55
7.4.250.0000.00816.32
7.4.240.0030.00416.51
7.4.230.0080.00016.29
7.4.220.0170.00916.50
7.4.210.0080.00616.51
7.4.200.0030.00316.29
7.4.190.0000.00716.66
7.4.160.0060.01016.47
7.4.150.0160.00317.40
7.4.140.0090.01117.86
7.4.130.0120.01016.46
7.4.120.0100.00916.41
7.4.110.0160.00416.46
7.4.100.0110.00716.66
7.4.90.0090.00916.48
7.4.80.0070.01019.39
7.4.70.0080.00816.49
7.4.60.0070.01316.63
7.4.50.0000.00716.36
7.4.40.0080.00522.77
7.4.30.0130.00316.39
7.4.00.0040.00714.58
7.3.330.0000.00513.27
7.3.320.0030.00313.21
7.3.310.0000.00716.41
7.3.300.0030.00316.27
7.3.290.0040.01116.27
7.3.280.0050.01016.32
7.3.270.0100.00717.40
7.3.260.0070.01016.48
7.3.250.0060.01116.31
7.3.240.0130.00916.27
7.3.230.0100.00716.45
7.3.210.0110.00516.27
7.3.200.0120.00619.39
7.3.190.0100.01316.43
7.3.180.0150.00616.43
7.3.170.0080.00816.28
7.3.160.0140.00316.45
7.3.120.0120.00314.76
7.2.330.0020.01516.38
7.2.320.0100.01016.34
7.2.310.0130.00616.39
7.2.300.0100.00716.63
7.2.290.0110.00716.63
7.2.60.0040.01116.61
7.2.00.0060.00619.29
7.1.200.0000.01315.51
7.1.100.0060.00917.90
7.1.70.0000.00916.84
7.1.60.0060.01919.82
7.1.50.0100.01316.54
7.1.00.0030.07722.44
7.0.200.0170.00316.63
7.0.140.0100.06722.00
7.0.100.0530.07720.28
7.0.90.0370.07020.04
7.0.80.0470.07019.98
7.0.70.0430.07720.05
7.0.60.0500.07720.16
7.0.50.0370.05720.43
7.0.40.0070.08320.14
7.0.30.0070.08320.09
7.0.20.0030.07720.20
7.0.10.0200.06720.14
7.0.00.0100.08020.04
5.6.280.0030.07320.95
5.6.250.0000.05720.66
5.6.240.0070.07720.72
5.6.230.0070.07320.74
5.6.220.0170.06320.52
5.6.210.0230.06320.60
5.6.200.0170.07321.10
5.6.190.0100.06020.98
5.6.180.0130.05721.09
5.6.170.0200.06321.21
5.6.160.0170.06321.07
5.6.150.0030.08720.98
5.6.140.0000.09321.21
5.6.130.0070.08720.98
5.6.120.0100.05021.05
5.6.110.0070.05321.11
5.6.100.0130.07721.08
5.6.90.0170.07721.04
5.6.80.0070.04720.36
5.6.70.0100.07320.36
5.6.60.0070.08320.36
5.6.50.0070.08720.51
5.6.40.0100.08320.45
5.6.30.0200.07020.32
5.6.20.0070.05020.33
5.6.10.0030.08720.53
5.6.00.0030.07720.34
5.5.380.0030.08320.44
5.5.370.0130.07020.42
5.5.360.0130.08320.38
5.5.350.0070.06320.45
5.5.340.0000.06020.84
5.5.330.0100.07320.88
5.5.320.0070.08020.95
5.5.310.0070.07320.88
5.5.300.0130.07720.86
5.5.290.0100.08020.77
5.5.280.0030.08320.92
5.5.270.0100.08320.94
5.5.260.0000.08020.87
5.5.250.0130.07720.69
5.5.240.0070.08020.19
5.5.230.0100.07320.21
5.5.220.0070.04320.15
5.5.210.0100.07320.28
5.5.200.0100.07320.17
5.5.190.0100.07320.32
5.5.180.0130.07320.29
5.5.160.0230.04320.30
5.5.150.0070.07320.21
5.5.140.0030.08720.27
5.5.130.0100.04720.12
5.5.120.0170.07020.28
5.5.110.0130.07020.31
5.5.100.0170.07320.13
5.5.90.0100.07320.21
5.5.80.0070.07720.02
5.5.70.0100.07020.21
5.5.60.0070.04720.09
5.5.50.0030.04020.16
5.5.40.0000.04720.09
5.5.30.0070.04320.09
5.5.20.0000.04320.18
5.5.10.0030.04320.00
5.5.00.0030.06020.14
5.4.450.0100.08019.18
5.4.440.0070.07719.49
5.4.430.0030.08319.45
5.4.420.0100.07719.23
5.4.410.0070.07719.40
5.4.400.0100.07319.04
5.4.390.0070.07719.13
5.4.380.0100.07318.91
5.4.370.0130.07019.04
5.4.360.0070.08319.04
5.4.350.0130.06318.89
5.4.340.0100.07318.88
5.4.320.0070.08019.14
5.4.310.0100.07718.85
5.4.300.0070.07719.16
5.4.290.0030.07319.14
5.4.280.0070.07319.16
5.4.270.0070.08019.14
5.4.260.0070.07719.21
5.4.250.0100.07018.89
5.4.240.0170.03718.95
5.4.230.0100.07319.02
5.4.220.0030.07019.03
5.4.210.0100.06019.05
5.4.200.0030.07319.21
5.4.190.0030.03719.13
5.4.180.0030.04019.04
5.4.170.0000.04019.13
5.4.160.0030.03719.02
5.4.150.0030.04018.88
5.4.140.0130.02716.41
5.4.130.0000.04316.42
5.4.120.0030.04016.41
5.4.110.0070.04016.42
5.4.100.0070.06016.48
5.4.90.0030.03716.48
5.4.80.0100.03016.55
5.4.70.0100.04016.43
5.4.60.0030.05016.39
5.4.50.0070.07316.40
5.4.40.0030.05716.35
5.4.30.0000.06016.38
5.4.20.0030.03316.33
5.4.10.0030.04016.38
5.4.00.0030.03315.88
5.3.290.0070.08014.67
5.3.280.0000.08714.59
5.3.270.0000.04014.67
5.3.260.0030.04014.73
5.3.250.0070.03314.73
5.3.240.0070.03714.64
5.3.230.0030.03714.67
5.3.220.0070.03314.55
5.3.210.0170.06314.50
5.3.200.0070.03314.64
5.3.190.0030.03714.56
5.3.180.0030.05014.52
5.3.170.0000.04014.58
5.3.160.0100.03714.57
5.3.150.0070.03314.57
5.3.140.0000.04014.54
5.3.130.0070.06714.61
5.3.120.0000.04714.53
5.3.110.0030.03714.56
5.3.100.0070.03314.28
5.3.90.0070.03014.28
5.3.80.0130.04014.28
5.3.70.0030.03714.28
5.3.60.0100.03014.28
5.3.50.0030.03314.28
5.3.40.0030.03714.28
5.3.30.0030.03314.28
5.3.20.0030.03314.28
5.3.10.0030.04314.28
5.3.00.0070.03314.28

preferences:
54.48 ms | 401 KiB | 5 Q