3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Desc: Imports new Categories into database bet3000 (expected to run once daily) */ ini_set('display_errors', 1); error_reporting(E_ALL & ~E_NOTICE); $possible_languages=array('de','en','tr','es','el','ru','fr'); $wanted_languages=array('de'); /* DB CONNECT */ $host = "localhost"; // Host name $username_mysql = "d01ff632"; // Mysql username $password_mysql = "achimundeva"; // Mysql password $db_name = "d01ff632"; // Database name /** Connect to server and select databse. * */ @mysql_connect("$host_mysql", "$username_mysql", "$password_mysql") or die("Cannot connect to database. Please edit the file settings.php"); mysql_select_db("$db_name") or die("Cannot select temp database."); mysql_query("SET NAMES 'utf8'"); /* IMPORT SPORTS CATEGORIES */ foreach ($wanted_languages as $lang) { echo "import categories for lang=$lang\n"; $url = "https://www.bet3000.com/".$lang."/jsonrpc/?jsonrpc=2.0&id=0&method=sportsbook.get_active_categories"; try { $data = file_get_contents($url); $data = json_decode($data, true); $query = "UPDATE home_categories SET active=0"; if (!$debug) { mysql_query($query); } $cat_lvl_ids[0] = array("id" => 0,"label" => ""); $prev_lvl = 0; $parent_id = 0; $index = 0; $flag = false; $sortid=0; foreach ($data ['categories'] as $key => $value){ $sortid++; $cat = new Category($value); $lvl = $cat->get_level(); $id = $cat->get_id(); $active = $cat->get_activated_id(); $cat_lvl_ids[$lvl]["id"] = $id; $parent_id = $cat_lvl_ids[$lvl-1]["id"]; $parent_lbl = ""; if(!empty($cat_lvl_ids[$lvl-1]["label"])) { $parent_lbl = $cat_lvl_ids[$lvl-1]["label"]." / "; } $path = $parent_lbl . $cat->get_label(); $cat_lvl_ids[$lvl]["label"] = $path; $explode = explode(" / ",$path); $detail = $explode[count($explode)-1]; $sport = $explode[0]; $qcheck="SELECT * FROM `home_categories` WHERE cid=".$id." AND lang='".$lang."'"; $rcheck=mysql_query($qcheck); if (mysql_num_rows($rcheck)>0) { $ocheck=mysql_fetch_object($rcheck); $sqladd =""; $sqladd.= ",path='".trim(mysql_real_escape_string($path))."', detail='".trim(mysql_real_escape_string($detail))."'"; // UPDATE path,detail,sortid,active $querynew="UPDATE home_categories SET active=".$active.",sortid=".$sortid.$sqladd." WHERE cid=".$id." AND lang='".$lang."'"; mysql_query($querynew); echo mysql_error(); } else { $sqlheaderadd=""; $sqladd =""; $query = "INSERT IGNORE INTO `home_categories` (cid,lang,detail,path,topcatid,stufe,sport,sortid,active) VALUES (". $id.", ". "'".$lang."', ". "'".trim(mysql_real_escape_string($detail))."', ". "'".trim(mysql_real_escape_string($path))."', ". $parent_id.", ". $lvl.", ". "'".trim(mysql_real_escape_string($sport))."', ". $sortid.", ". $active. ")"; $resultInsert = mysql_query($query); if(!$resultInsert) echo mysql_error()."<br>$query"; } $prev_lvl = $lvl; } //foreach($result as $v) { // echo $value."<br>"; //} } catch(Exception $e) { echo $e->getMessage(); } } echo 'Categories added to database'; class Category { private $id; private $lvl; private $label; private $activated_id; private $children; public function __construct($cat) { $this->id = $cat['id']; $this->lvl = $cat['level']; $this->label = $cat['label']; $this->activated_id = $cat['activated_id']; $this->children = array(); } public function get_id() { return $this->id; } public function get_level() { return $this->lvl; } public function get_label() { return $this->label; } public function get_activated_id() { return $this->activated_id; } public function get_children() { return $this->children; } public function set_id($id) { $this->id = $id; } public function set_level($lvl) { $this->lvl = $lvl; } public function set_label($label) { $this->label = $label; } public function set_children($children) { $this->children = $children; } public function add_child($child) { $this->children[] = $child; } public function get_child($index) { return $this->children[$index]; } public function remove_child($child,$index) { $this->children[] = null; } public function __toString() { return "Category Lvl:".$this->get_level()." - ".$this->get_id(). ":".$this->get_label(); } }

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.0060.00916.63
8.3.50.0120.00618.18
8.3.40.0110.01118.95
8.3.30.0040.01118.97
8.3.20.0070.00020.29
8.3.10.0040.00423.39
8.3.00.0060.00319.35
8.2.180.0060.01016.63
8.2.170.0170.00322.96
8.2.160.0100.00320.70
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00419.82
8.2.110.0040.00420.69
8.2.100.0080.00418.05
8.2.90.0040.00419.36
8.2.80.0030.00717.97
8.2.70.0060.00317.75
8.2.60.0090.00317.68
8.2.50.0040.00418.07
8.2.40.0030.00519.49
8.2.30.0040.00820.83
8.2.20.0030.00617.87
8.2.10.0000.00918.30
8.2.00.0000.00718.23
8.1.270.0090.00023.80
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0060.00322.47
8.1.230.0060.00617.91
8.1.220.0000.00817.91
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0080.00017.48
8.1.180.0050.00318.10
8.1.170.0000.00918.50
8.1.160.0000.00822.04
8.1.150.0030.00719.02
8.1.140.0060.00319.76
8.1.130.0040.00417.74
8.1.120.0030.00617.53
8.1.110.0050.00217.56
8.1.100.0060.00317.50
8.1.90.0000.00817.58
8.1.80.0050.00317.56
8.1.70.0000.00717.51
8.1.60.0060.00317.70
8.1.50.0000.00817.49
8.1.40.0000.00817.61
8.1.30.0060.00317.73
8.1.20.0040.00417.79
8.1.10.0000.00817.59
8.1.00.0040.00417.59
8.0.300.0000.00718.77
8.0.290.0000.00816.88
8.0.280.0040.00418.49
8.0.270.0040.00417.25
8.0.260.0050.00217.42
8.0.250.0070.00017.20
8.0.240.0000.00717.03
8.0.230.0040.00417.16
8.0.220.0070.00016.96
8.0.210.0070.00017.13
8.0.200.0030.00317.15
8.0.190.0000.00817.18
8.0.180.0030.00517.16
8.0.170.0000.01017.07
8.0.160.0000.00717.09
8.0.150.0040.00417.06
8.0.140.0040.00416.91
8.0.130.0000.00613.50
8.0.120.0040.00417.04
8.0.110.0040.00416.99
8.0.100.0040.00416.89
8.0.90.0040.00416.94
8.0.80.0160.00617.06
8.0.70.0040.00417.07
8.0.60.0030.00516.90
8.0.50.0030.00616.96
8.0.30.0160.00417.17
8.0.20.0090.01317.44
8.0.10.0020.00517.00
8.0.00.0080.01116.94
7.4.330.0000.00516.79
7.4.320.0060.00016.72
7.4.300.0040.00416.75
7.4.290.0070.00016.64
7.4.280.0030.00616.64
7.4.270.0030.00316.68
7.4.260.0040.00416.66
7.4.250.0000.00816.62
7.4.240.0040.00416.63
7.4.230.0030.00316.63
7.4.220.0060.01516.65
7.4.210.0090.01016.74
7.4.200.0030.00316.71
7.4.160.0060.01016.61
7.4.150.0100.01017.40
7.4.140.0140.00817.86
7.4.130.0120.00916.64
7.4.120.0080.01116.75
7.4.110.0070.01116.57
7.4.100.0130.00616.64
7.4.90.0100.00716.71
7.4.80.0070.01119.39
7.4.70.0100.01616.80
7.4.60.0080.00816.54
7.4.50.0110.00716.66
7.4.40.0070.01016.51
7.4.30.0060.01316.63
7.4.10.0140.00315.09
7.4.00.0080.00915.11
7.3.330.0060.00013.29
7.3.320.0060.00013.29
7.3.310.0030.00316.42
7.3.300.0000.00716.39
7.3.290.0030.00316.42
7.3.280.0060.01116.37
7.3.270.0090.00917.40
7.3.260.0060.01616.70
7.3.250.0140.00816.49
7.3.240.0100.00716.46
7.3.230.0040.01316.44
7.3.210.0100.00716.66
7.3.200.0030.01416.37
7.3.190.0070.01116.61
7.3.180.0080.00816.47
7.3.170.0100.01016.41
7.3.160.0030.01416.51
7.3.130.0060.01214.82
7.3.120.0100.00714.95
7.3.110.0070.01114.95
7.3.100.0060.00915.08
7.3.90.0030.01114.90
7.3.80.0030.00814.87
7.3.70.0050.00914.82
7.3.60.0080.00614.89
7.3.50.0030.01214.94
7.3.40.0050.01014.86
7.3.30.0080.00814.86
7.3.20.0070.00816.52
7.3.10.0060.00816.46
7.3.00.0040.00716.60
7.2.330.0110.00716.84
7.2.320.0030.01416.66
7.2.310.0130.00616.84
7.2.300.0030.01716.36
7.2.290.0030.01316.37
7.2.260.0040.01215.31
7.2.250.0080.00715.17
7.2.240.0030.01215.10
7.2.230.0110.00514.96
7.2.220.0110.00515.11
7.2.210.0100.00414.92
7.2.200.0080.00715.03
7.2.190.0050.01015.15
7.2.180.0050.00915.00
7.2.170.0060.01114.84
7.2.160.0050.01115.01
7.2.150.0040.01516.51
7.2.140.0030.00916.82
7.2.130.0080.00716.76
7.2.120.0070.00916.78
7.2.110.0090.00616.85
7.2.100.0080.00516.60
7.2.90.0040.01016.69
7.2.80.0060.00916.82
7.2.70.0020.01116.72
7.2.60.0060.00716.73
7.2.50.0050.00916.87
7.2.40.0070.00916.87
7.2.30.0070.00816.86
7.2.20.0090.00616.74
7.2.10.0060.00816.84
7.2.00.0050.00817.38
7.1.330.0040.01315.59
7.1.320.0030.01215.68
7.1.310.0020.00915.72
7.1.300.0050.00915.53
7.1.290.0050.00815.72
7.1.280.0080.00515.73
7.1.270.0080.00815.61
7.1.260.0060.00815.64
7.1.250.0050.00915.67
7.1.240.0060.00815.75
7.1.230.0060.00715.76
7.1.220.0030.01215.68
7.1.210.0080.00715.74
7.1.200.0060.00915.67
7.1.190.0090.00615.72
7.1.180.0020.01115.68
7.1.170.0060.00415.81
7.1.160.0050.00915.69
7.1.150.0050.00915.67
7.1.140.0040.00815.59
7.1.130.0060.00515.77
7.1.120.0050.00615.57
7.1.110.0070.00815.74
7.1.100.0040.00816.38
7.1.90.0050.00815.75
7.1.80.0040.00815.66
7.1.70.0030.00916.04
7.1.60.0070.01116.61
7.1.50.0050.00915.93
7.1.40.0070.00615.68
7.1.30.0040.00915.61
7.1.20.0030.01015.62
7.1.10.0060.00615.69
7.1.00.0040.02717.34
7.0.330.0060.00715.34
7.0.320.0080.00515.42
7.0.310.0070.00615.26
7.0.300.0090.00315.38
7.0.290.0050.00615.22
7.0.280.0090.00415.35
7.0.270.0020.00915.38
7.0.260.0060.00715.26
7.0.250.0050.00815.43
7.0.240.0070.00615.44
7.0.230.0050.00815.33
7.0.220.0040.00915.17
7.0.210.0060.00715.34
7.0.200.0060.00615.72
7.0.190.0040.00915.34
7.0.180.0040.00815.40
7.0.170.0030.00715.28
7.0.160.0040.00715.32
7.0.150.0020.00915.39
7.0.140.0070.00615.28
7.0.130.0060.00615.34
7.0.120.0030.00815.46
7.0.110.0050.01015.40
7.0.100.0050.03016.52
7.0.90.0080.02516.57
7.0.80.0100.02216.57
7.0.70.0070.02816.50
7.0.60.0060.02216.54
7.0.50.0060.02516.59
7.0.40.0040.02115.04
7.0.30.0080.02415.02
7.0.20.0070.01815.04
7.0.10.0040.02715.07
7.0.00.0060.02315.01
5.6.400.0040.01014.64
5.6.390.0030.01014.37
5.6.380.0060.01014.33
5.6.370.0060.00714.30
5.6.360.0010.01214.38
5.6.350.0070.00714.43
5.6.340.0020.00914.48
5.6.330.0040.00814.15
5.6.320.0060.00614.11
5.6.310.0050.00914.65
5.6.300.0050.00914.55
5.6.290.0030.01214.37
5.6.280.0040.01515.88
5.6.270.0050.00914.40
5.6.260.0060.00914.17
5.6.250.0060.02516.07
5.6.240.0060.02215.96
5.6.230.0080.02515.81
5.6.220.0070.02815.88
5.6.210.0080.02415.76
5.6.200.0060.02416.10
5.6.190.0050.02416.24
5.6.180.0070.02416.07
5.6.170.0100.02515.96
5.6.160.0030.02616.00
5.6.150.0060.02315.96
5.6.140.0060.02416.12
5.6.130.0070.02816.04
5.6.120.0040.02815.92
5.6.110.0060.02715.97
5.6.100.0070.02216.02
5.6.90.0070.01716.07
5.6.80.0090.02515.82
5.6.70.0050.02315.81
5.6.60.0050.01715.76
5.6.50.0070.02415.90
5.6.40.0090.02315.87
5.6.30.0080.02415.78
5.6.20.0090.01715.74
5.6.10.0040.02615.78
5.6.00.0050.02615.86
5.5.380.0050.01815.12
5.5.370.0090.02415.04
5.5.360.0060.02615.04
5.5.350.0060.01714.93
5.5.340.0050.02815.19
5.5.330.0080.02415.19
5.5.320.0080.02215.16
5.5.310.0090.02515.14
5.5.300.0060.02515.01
5.5.290.0060.02215.05
5.5.280.0060.02515.15
5.5.270.0070.02415.16
5.5.260.0070.01915.09
5.5.250.0060.02415.01
5.5.240.0080.02214.92
5.5.230.0060.02414.96
5.5.220.0050.01714.89
5.5.210.0080.02214.96
5.5.200.0060.02514.83
5.5.190.0110.01314.91
5.5.180.0090.02214.99
5.5.170.0060.00713.15
5.5.160.0050.02514.87
5.5.150.0070.02415.00
5.5.140.0070.02414.89
5.5.130.0030.02714.94
5.5.120.0070.01714.91
5.5.110.0050.02714.96
5.5.100.0080.02314.95
5.5.90.0030.02514.85
5.5.80.0050.02314.88
5.5.70.0060.02415.00
5.5.60.0060.01914.97
5.5.50.0050.02414.91
5.5.40.0050.02214.86
5.5.30.0070.01914.90
5.5.20.0060.02414.82
5.5.10.0030.02814.84
5.5.00.0060.02314.86

preferences:
53.26 ms | 400 KiB | 5 Q