3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* IMPORT SPORTS CATEGORIES */ 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.0110.00416.63
8.3.50.0110.01021.98
8.3.40.0090.00619.09
8.3.30.0090.00618.93
8.3.20.0040.00420.48
8.3.10.0060.00323.66
8.3.00.0080.00019.23
8.2.180.0150.00016.88
8.2.170.0000.01522.96
8.2.160.0000.01520.58
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.00317.63
8.2.120.0080.00026.35
8.2.110.0090.00021.10
8.2.100.0090.00318.16
8.2.90.0080.00019.39
8.2.80.0040.00417.97
8.2.70.0060.00617.25
8.2.60.0060.00618.05
8.2.50.0080.00018.07
8.2.40.0060.00319.64
8.2.30.0060.00620.77
8.2.20.0050.00517.76
8.2.10.0000.00818.14
8.2.00.0040.00418.35
8.1.280.0070.00725.92
8.1.270.0090.00023.99
8.1.260.0030.00526.35
8.1.250.0000.00828.09
8.1.240.0070.00319.50
8.1.230.0080.00417.78
8.1.220.0050.00318.01
8.1.210.0030.00618.77
8.1.200.0060.00317.48
8.1.190.0000.00817.38
8.1.180.0040.00418.10
8.1.170.0000.00918.54
8.1.160.0000.00722.05
8.1.150.0040.00419.01
8.1.140.0080.00019.61
8.1.130.0070.00017.75
8.1.120.0030.00617.62
8.1.110.0050.00317.56
8.1.100.0050.00217.55
8.1.90.0000.00717.45
8.1.80.0050.00217.50
8.1.70.0040.00417.43
8.1.60.0060.00317.71
8.1.50.0030.00617.55
8.1.40.0040.00417.68
8.1.30.0040.00417.70
8.1.20.0000.00817.61
8.1.10.0050.00317.60
8.1.00.0050.00317.52
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0000.00718.57
8.0.270.0050.00317.52
8.0.260.0070.00017.51
8.0.250.0000.00817.23
8.0.240.0040.00417.23
8.0.230.0030.00317.18
8.0.220.0040.00417.14
8.0.210.0000.00717.06
8.0.200.0070.00017.23
8.0.190.0090.00017.23
8.0.180.0000.00717.12
8.0.170.0050.00317.06
8.0.160.0040.00417.18
8.0.150.0000.00717.04
8.0.140.0040.00417.02
8.0.130.0030.00313.60
8.0.120.0000.00817.00
8.0.110.0030.00517.14
8.0.100.0000.00717.10
8.0.90.0000.00817.10
8.0.80.0100.01017.04
8.0.70.0000.00817.24
8.0.60.0000.00717.11
8.0.50.0040.00417.02
8.0.30.0140.00717.28
8.0.20.0110.01117.41
8.0.10.0040.00417.19
8.0.00.0110.00716.94
7.4.330.0000.00616.72
7.4.320.0060.00016.71
7.4.300.0060.00016.71
7.4.290.0050.00216.61
7.4.280.0000.00816.69
7.4.270.0030.00316.61
7.4.260.0040.00416.61
7.4.250.0000.00816.70
7.4.240.0020.00616.74
7.4.230.0040.00416.66
7.4.220.0100.01016.68
7.4.210.0050.00916.68
7.4.200.0070.00016.64
7.4.160.0100.00716.95
7.4.150.0070.01417.40
7.4.140.0150.00817.86
7.4.130.0070.01116.58
7.4.120.0080.01116.74
7.4.110.0070.01016.80
7.4.100.0070.01116.60
7.4.90.0090.00916.47
7.4.80.0110.00719.39
7.4.70.0070.01116.59
7.4.60.0090.00916.66
7.4.50.0070.00616.78
7.4.40.0110.00716.38
7.4.30.0140.00316.83
7.4.10.0080.00915.15
7.4.00.0070.01115.23
7.3.330.0000.00713.54
7.3.320.0030.00313.57
7.3.310.0050.00316.48
7.3.300.0000.00716.60
7.3.290.0030.00316.42
7.3.280.0130.01116.61
7.3.270.0120.00617.40
7.3.260.0040.01416.71
7.3.250.0150.00616.66
7.3.240.0090.01216.70
7.3.230.0110.00816.53
7.3.210.0030.01416.60
7.3.200.0110.00616.75
7.3.190.0090.01216.78
7.3.180.0230.03716.78
7.3.170.0120.00616.65
7.3.160.0030.01316.61
7.3.130.0090.00614.97
7.3.120.0080.01115.04
7.3.110.0070.01214.90
7.3.100.0090.00615.07
7.3.90.0050.00814.80
7.3.80.0060.00915.04
7.3.70.0070.00614.90
7.3.60.0050.00814.98
7.3.50.0060.00914.94
7.3.40.0040.00814.83
7.3.30.0070.00714.99
7.3.20.0050.00916.78
7.3.10.0080.00516.79
7.3.00.0070.00616.58
7.2.330.0160.00316.78
7.2.320.0140.00416.90
7.2.310.0070.01616.79
7.2.300.0200.01616.79
7.2.290.0090.00916.79
7.2.260.0030.01515.12
7.2.250.0070.01214.94
7.2.240.0070.00515.25
7.2.230.0050.01115.14
7.2.220.0030.01415.27
7.2.210.0050.01215.25
7.2.200.0040.01015.25
7.2.190.0080.00914.98
7.2.180.0030.01415.13
7.2.170.0090.00315.19
7.2.160.0030.01115.17
7.2.150.0060.00816.99
7.2.140.0030.01116.98
7.2.130.0080.00516.94
7.2.120.0050.00617.00
7.2.110.0060.00716.84
7.2.100.0070.00716.97
7.2.90.0040.00816.94
7.2.80.0050.00717.02
7.2.70.0050.01116.98
7.2.60.0100.00316.94
7.2.50.0050.00716.83
7.2.40.0060.00816.87
7.2.30.0080.00616.79
7.2.20.0040.00816.94
7.2.10.0070.00916.80
7.2.00.0070.00717.56
7.1.330.0070.00915.97
7.1.320.0080.00715.76
7.1.310.0050.00715.84
7.1.300.0070.00815.80
7.1.290.0070.00715.73
7.1.280.0060.00815.66
7.1.270.0070.00515.82
7.1.260.0050.00715.88
7.1.250.0030.00715.79
7.1.240.0040.01015.80
7.1.230.0020.01215.93
7.1.220.0070.00715.76
7.1.210.0040.00815.81
7.1.200.0060.00715.87
7.1.190.0090.00715.86
7.1.180.0060.00615.77
7.1.170.0050.00715.74
7.1.160.0050.00915.83
7.1.150.0070.00815.74
7.1.140.0080.00615.88
7.1.130.0030.00815.78
7.1.120.0070.00915.74
7.1.110.0060.00915.90
7.1.100.0070.00716.60
7.1.90.0060.01015.90
7.1.80.0040.00815.86
7.1.70.0020.01416.22
7.1.60.0080.01016.81
7.1.50.0060.00916.16
7.1.40.0040.00815.90
7.1.30.0050.00715.58
7.1.20.0070.00715.80
7.1.10.0050.00615.80
7.1.00.0070.02317.49
7.0.330.0040.00615.50
7.0.320.0060.00815.53
7.0.310.0050.00715.48
7.0.300.0050.00515.36
7.0.290.0050.00815.45
7.0.280.0060.00415.38
7.0.270.0040.01115.37
7.0.260.0050.00515.43
7.0.250.0050.00815.50
7.0.240.0040.00815.39
7.0.230.0030.01215.55
7.0.220.0070.00515.45
7.0.210.0030.01115.50
7.0.200.0190.01015.27
7.0.190.0030.01115.58
7.0.180.0050.00815.50
7.0.170.0070.00515.50
7.0.160.0050.00815.36
7.0.150.0060.00515.45
7.0.140.0080.00615.28
7.0.130.0040.00815.41
7.0.120.0050.01015.44
7.0.110.0040.00915.40
7.0.100.0070.02616.63
7.0.90.0070.02616.74
7.0.80.0060.02616.74
7.0.70.0140.02516.71
7.0.60.0100.02816.61
7.0.50.0120.02416.95
7.0.40.0060.02515.31
7.0.30.0060.02815.13
7.0.20.0070.02415.25
7.0.10.0080.02515.24
7.0.00.0100.02115.24
5.6.400.0030.00814.32
5.6.390.0040.00914.31
5.6.380.0030.00614.49
5.6.370.0040.01114.43
5.6.360.0040.00714.31
5.6.350.0070.01014.33
5.6.340.0060.00414.31
5.6.330.0060.00814.70
5.6.320.0060.00714.35
5.6.310.0090.00314.42
5.6.300.0080.00714.44
5.6.290.0040.01014.48
5.6.280.0030.02716.00
5.6.270.0040.01014.36
5.6.260.0060.00914.27
5.6.250.0100.02416.16
5.6.240.0070.02616.13
5.6.230.0070.01916.05
5.6.220.0060.02915.88
5.6.210.0070.02616.06
5.6.200.0070.02516.06
5.6.190.0040.03116.19
5.6.180.0060.02316.22
5.6.170.0080.02516.32
5.6.160.0070.02716.16
5.6.150.0070.02416.04
5.6.140.0080.02616.19
5.6.130.0090.02216.11
5.6.120.0070.02616.27
5.6.110.0060.02416.21
5.6.100.0070.02416.14
5.6.90.0050.02716.18
5.6.80.0070.02616.13
5.6.70.0040.03115.87
5.6.60.0060.02115.89
5.6.50.0080.02515.92
5.6.40.0080.02515.96
5.6.30.0090.02415.86
5.6.20.0060.02115.94
5.6.10.0070.02515.88
5.6.00.0060.02516.04
5.5.380.0060.02615.83
5.5.370.0050.02915.88
5.5.360.0070.02616.00
5.5.350.0090.02516.00
5.5.340.0060.02816.00
5.5.330.0050.02516.11
5.5.320.0090.01516.06
5.5.310.0040.03016.23
5.5.300.0070.02616.11
5.5.290.0090.02616.07
5.5.280.0080.02616.05
5.5.270.0100.02215.96
5.5.260.0080.02316.18
5.5.250.0060.02815.92
5.5.240.0060.02515.78
5.5.230.0110.02115.79
5.5.220.0080.02515.81
5.5.210.0070.02315.78
5.5.200.0040.03015.81
5.5.190.0120.02115.79
5.5.180.0070.02715.87
5.5.170.0050.01014.26
5.5.160.0070.02815.77
5.5.150.0050.02215.79
5.5.140.0040.02615.86
5.5.130.0070.02415.79
5.5.120.0070.02715.93
5.5.110.0070.02315.84
5.5.100.0060.02515.80
5.5.90.0090.01815.86
5.5.80.0030.02015.83
5.5.70.0070.01915.68
5.5.60.0030.01715.80
5.5.50.0050.01615.87
5.5.40.0030.01915.75
5.5.30.0060.01315.74
5.5.20.0070.01315.73
5.5.10.0040.01915.78
5.5.00.0030.02115.85
5.4.450.0130.08019.74
5.4.440.0070.08719.63
5.4.430.0070.08719.75
5.4.420.0100.05019.68
5.4.410.0030.07019.70
5.4.400.0070.07719.57
5.4.390.0000.08319.57
5.4.380.0030.08319.49
5.4.370.0030.08319.41
5.4.360.0030.08319.42
5.4.350.0100.08019.57
5.4.340.0100.07019.52
5.4.320.0030.08319.27
5.4.310.0070.08019.48
5.4.300.0030.07719.35
5.4.290.0130.06019.28
5.4.280.0070.07319.57
5.4.270.0070.07719.49
5.4.260.0070.07719.47
5.4.250.0070.04319.35
5.4.240.0170.03319.56
5.4.230.0030.05019.16
5.4.220.0030.04019.48
5.4.210.0030.04019.30
5.4.200.0000.04319.60
5.4.190.0030.03719.59
5.4.180.0000.04019.26
5.4.170.0070.03319.37
5.4.160.0070.03319.28
5.4.150.0070.03719.36
5.4.140.0100.03016.49
5.4.130.0100.05716.46
5.4.120.0000.04016.31
5.4.110.0030.03716.46
5.4.100.0070.03016.43
5.4.90.0100.03016.47
5.4.80.0030.05016.39
5.4.70.0100.03316.51
5.4.60.0100.03016.51
5.4.50.0070.03016.35
5.4.40.0000.04316.50
5.4.30.0000.05016.46
5.4.20.0030.03716.48
5.4.10.0000.04716.40
5.4.00.0000.04015.88
5.3.290.0100.07014.84
5.3.280.0030.04014.77
5.3.270.0000.04314.80
5.3.260.0030.04014.69
5.3.250.0000.04014.58
5.3.240.0000.04014.75
5.3.230.0000.04714.71
5.3.220.0000.04014.68
5.3.210.0030.03714.60
5.3.200.0070.03714.75
5.3.190.0000.04314.55
5.3.180.0030.03714.55
5.3.170.0000.04714.68
5.3.160.0000.04014.63
5.3.150.0000.04714.64
5.3.140.0000.04014.68
5.3.130.0070.03314.66
5.3.120.0070.03714.71
5.3.110.0200.02314.67
5.3.100.0030.03314.22
5.3.90.0200.02014.04
5.3.80.0070.03714.09
5.3.70.0000.04714.00
5.3.60.0030.03714.16
5.3.50.0030.03713.93
5.3.40.0070.03313.93
5.3.30.0070.03714.04
5.3.20.0070.03013.79
5.3.10.0070.03013.79
5.3.00.0070.03313.62
5.2.170.0030.03011.09
5.2.160.0030.03711.07
5.2.150.0000.03011.19
5.2.140.0000.03711.32
5.2.130.0030.03011.16
5.2.120.0000.04011.08
5.2.110.0000.03011.19
5.2.100.0000.03011.15
5.2.90.0000.03311.22
5.2.80.0000.03011.02
5.2.70.0030.03011.04
5.2.60.0030.02711.00
5.2.50.0030.02711.22
5.2.40.0000.03011.06
5.2.30.0000.05011.02
5.2.20.0070.05010.67
5.2.10.0070.02310.75
5.2.00.0030.06310.54
5.1.60.0030.05310.16
5.1.50.0070.05010.06
5.1.40.0000.06010.12
5.1.30.0070.05310.36
5.1.20.0030.06010.49
5.1.10.0100.04010.14
5.1.00.0030.05310.24
5.0.50.0100.0408.74
5.0.40.0000.0408.37
5.0.30.0070.0338.30
5.0.20.0030.0408.16
5.0.10.0070.0408.37
5.0.00.0030.0638.25
4.4.90.0000.0177.80
4.4.80.0000.0177.80
4.4.70.0000.0277.80
4.4.60.0070.0107.80
4.4.50.0000.0207.80
4.4.40.0000.0577.80
4.4.30.0000.0177.80
4.4.20.0070.0337.80
4.4.10.0070.0337.80
4.4.00.0070.0507.80
4.3.110.0000.0377.80
4.3.100.0000.0377.80
4.3.90.0070.0307.80
4.3.80.0030.0537.80
4.3.70.0030.0337.80
4.3.60.0070.0307.80
4.3.50.0070.0337.80
4.3.40.0030.0437.80
4.3.30.0070.0207.80
4.3.20.0070.0337.80
4.3.10.0030.0337.80
4.3.00.0000.0337.80

preferences:
49.6 ms | 401 KiB | 5 Q