3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Download { protected $db; protected $client; public $download; public $downloads; public $free_downloads; public $downloads_count; public $info; public $file; public $status; function __construct($db,$client) { $this->db = $db; $this->client = $client; } public function getDownloads() { if($result = $this->db->query("SELECT * FROM downloads WHERE client_id='".$this->db->real_escape_string($this->client['id'])."' ORDER BY id DESC")) { $return = array(); while($a = $result->fetch_assoc()) { $return[] = $a; } $this->downloads_count = $result->num_rows; $this->downloads = $return; $result->free(); } else { die('Database error: ('.$this->db->errno.') '.$this->db->error); } } public function getFreeDownloads() { if($result = $this->db->query("SELECT * FROM products WHERE cat='freedownload' AND active='yes'")) { $return = array(); while($a = $result->fetch_assoc()) { $return[] = $a; } $this->free_downloads = $return; $result->free(); } else { die('Database error: ('.$this->db->errno.') '.$this->db->error); } } public function getSingleDownload($id) { if($result = $this->db->query("SELECT * FROM downloads WHERE id='".$this->db->real_escape_string($id)."' AND client_id='".$this->db->real_escape_string($this->client['id'])."'")) { if($result->num_rows == 1) { $this->status = 'OK'; $this->download = $result->fetch_array(); } else { $this->status = 'Kon de download niet vinden.'; } $result->free(); } else { $this->status = 'Database error: ('.$this->db->errno.') '.$this->db->error; } } public function getProduct($id) { if($result = $this->db->query("SELECT * FROM products WHERE id='".$this->db->real_escape_string($id)."' AND cat='download' AND active='yes' OR id='".$this->db->real_escape_string($id)."' AND cat='freedownload' AND active='yes'")) { if($result->num_rows == 1) { $this->info = $result->fetch_array(); $this->status = 'OK'; } else { $this->info = null; $this->status = 'NOK'; } $result->free(); } else { $this->status = 'NOK'; die('Database error: ('.$this->db->errno.') '.$this->db->error); } } public function addDownload($product_id,$key,$key2,$com='no',$uses) { if($this->db->query("INSERT INTO downloads (client_id,product_id,key1,key2,com_use,uses,created) VALUES ( '".$this->db->real_escape_string($this->client['id'])."', '".$this->db->real_escape_string($product_id)."', '".$this->db->real_escape_string($key1)."', '".$this->db->real_escape_string($key2)."', '".$this->db->real_escape_string($com)."', '".$this->db->real_escape_string(uses)."', NOW() )")) { $this->status = 'OK'; } else { $this->status = 'Database error: ('.$this->db->errno.') '.$this->db->error; } } public function updateDownload($id) { if($this->db->query("UPDATE downloads SET used=used+1 WHERE id='".$this->db->real_escape_string($id)."'")) { $this->status = 'OK'; } else { $this->status = 'Database error: ('.$this->db->errno.') '.$this->db->error; } } public function download($id, $free=true) { if($free == true) { $this->getProduct($id); if($this->status = 'OK') { if($this->info['price'] > 0 || $this->info['cat'] != 'freedownload') { $this->status = 'Kon download niet ophalen'; } else { $this->file['name'] = 'MijnSweetGroups_FreeDownload_'.$this->info['id'].'_'.uniqid().'.zip'; $this->file['download'] = '/home/sweet/domains/sweetgroups.net/DOWNLOADS/'.$this->info['download_map'].'/'; $this->file['replace'] = array( '{%WEBSITES%}' => 'UNLIMITED', '{%UPDATE%}' => $this->info['description'], '{%LICENSE_CAT%}' => 'FREE', '{%LICENSE_KEY1%}' => 'NONE', '{%LICENSE_KEY2%}' => 'NONE' ); } } else { $this->status = 'Kon download niet ophalen'; } } else { $this->getSingleDownload($id); if($this->status = 'OK') { if($this->download['used'] < $this->download['uses']) { $this->getProduct($this->download['product_id']); if($this->status = 'OK') { $this->file['id'] = $id; if($this->info['download_map'] == '') { $this->info['download_map'] = 'unknown'; } if($this->download['com_use'] == 'yes') { $this->file['name'] = 'MijnSweetGroups_Download_'.$this->download['id'].'_Com.zip'; $this->file['download'] = '/home/sweet/domains/sweetgroups.net/DOWNLOADS/'.$this->info['download_map'].'_com'; $this->file['replace'] = array( '{%WEBSITES%}' => '1', '{%UPDATE%}' => $this->info['description'], '{%LICENSE_CAT%}' => 'SINGLE COMMERCIAL', '{%LICENSE_KEY1%}' => $this->download['key1'], '{%LICENSE_KEY2%}' => $this->download['key2'] ); } else { $this->file['name'] = 'MijnSweetGroups_Download_'.$this->download['id'].'.zip'; $this->file['download'] = '/home/sweet/domains/sweetgroups.net/DOWNLOADS/'.$this->info['download_map'].'/'; $this->file['replace'] = array( '{%WEBSITES%}' => '1', '{%UPDATE%}' => $this->info['description'], '{%LICENSE_CAT%}' => 'SINGLE', '{%LICENSE_KEY1%}' => $this->download['key1'], '{%LICENSE_KEY2%}' => $this->download['key2'] ); } $this->status = 'OK'; } else { $this->status = 'Kon download niet ophalen'; } } else { $this->status = 'Download is al reeds gebruikt of download is niet gevonden.'; } } else { $this->status = 'Kon download niet ophalen'; } } } public function getStatus($status) { switch($status) { case 'notused': return '<span class="grey">Niet gebruikt</span>'; break; case 'canceled': return '<span class="red">Geannuleerd</span>'; break; case 'pending': return '<span class="orange">Wordt gemaakt</span>'; break; case 'delivered': return '<span class="green">Geleverd</span>'; break; default: return '<span class="grey">Onbekend</span>'; } } } ?>

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)
7.1.70.0060.00616.62
7.1.60.0130.01319.33
7.1.50.0110.00716.80
7.1.00.0030.07722.40
7.0.200.0130.00316.63
7.0.140.0030.07322.11
7.0.110.0070.08020.04
7.0.100.0030.08320.17
7.0.90.0100.07320.05
7.0.80.0130.07720.06
7.0.70.0130.04020.05
7.0.60.0100.08020.13
7.0.50.0070.07320.09
7.0.40.0030.05019.86
7.0.30.0130.07319.78
7.0.20.0200.07019.66
7.0.10.0030.08019.75
7.0.00.0230.06319.82
5.6.280.0030.07321.13
5.6.260.0030.06320.69
5.6.250.0100.07320.61
5.6.240.0170.07020.73
5.6.230.0100.07720.91
5.6.220.0030.07720.73
5.6.210.0100.08020.74
5.6.200.0100.07720.72
5.6.190.0030.05320.70
5.6.180.0000.09020.64
5.6.170.0030.07320.70
5.6.160.0030.08320.74
5.6.150.0170.06720.61
5.6.140.0070.08320.75
5.6.130.0030.05320.76
5.6.120.0170.07320.67
5.6.110.0100.04720.69
5.6.100.0100.04320.71
5.6.90.0030.05020.50
5.6.80.0070.07320.05
5.6.70.0070.08320.11
5.6.60.0100.04020.13
5.6.50.0100.07320.00
5.6.40.0030.06019.89
5.6.30.0130.07319.89
5.6.20.0070.08320.03
5.6.10.0030.08320.12
5.6.00.0000.08719.98
5.5.380.0000.08717.61
5.5.370.0100.05017.54
5.5.360.0000.08717.65
5.5.350.0100.05717.60
5.5.340.0070.07317.98
5.5.330.0100.07717.96
5.5.320.0070.07717.97
5.5.310.0030.08318.20
5.5.300.0000.06018.16
5.5.290.0070.08018.13
5.5.280.0030.07317.98
5.5.270.0030.08717.98
5.5.260.0030.05718.26
5.5.250.0170.07017.98
5.5.240.0130.07717.55
5.5.230.0000.05017.52
5.5.220.0070.04017.53
5.5.210.0000.06717.31
5.5.200.0100.09017.64
5.5.190.0070.04717.31
5.5.180.0000.08017.55
5.5.160.0000.04317.64
5.5.150.0130.06717.35
5.5.140.0070.07717.63
5.5.130.0130.03717.25
5.5.120.0000.04717.61
5.5.110.0030.04017.37
5.5.100.0100.06717.39
5.5.90.0100.05717.51
5.5.80.0070.07317.50
5.5.70.0100.06317.41
5.5.60.0070.06317.21
5.5.50.0070.08017.40
5.5.40.0030.05017.37
5.5.30.0000.08717.22
5.5.20.0130.07017.37
5.5.10.0130.07317.27
5.5.00.0070.08017.52
5.4.450.0100.07719.34
5.4.440.0030.08719.34
5.4.430.0070.08319.41
5.4.420.0030.07719.48
5.4.410.0000.06319.23
5.4.400.0000.08019.10
5.4.390.0030.06019.14
5.4.380.0130.06719.34
5.4.370.0070.04019.01
5.4.360.0030.05319.20
5.4.350.0100.05319.32
5.4.340.0130.07719.02
5.4.320.0030.08018.93
5.4.310.0070.07719.27
5.4.300.0130.04018.95
5.4.290.0100.04019.13
5.4.280.0000.05019.33
5.4.270.0030.06319.26
5.4.260.0030.06019.00
5.4.250.0170.06719.00
5.4.240.0070.06019.30
5.4.230.0030.03719.33
5.4.220.0030.07718.99
5.4.210.0100.06319.00
5.4.200.0170.06019.33
5.4.190.0070.06719.33
5.4.180.0070.04719.08
5.4.170.0130.07319.13
5.4.160.0100.07718.99
5.4.150.0070.07318.98
5.4.140.0070.08016.54
5.4.130.0030.08016.34
5.4.120.0070.07716.40
5.4.110.0100.07316.61
5.4.100.0030.07716.63
5.4.90.0100.04716.51
5.4.80.0200.05716.44
5.4.70.0000.08016.55
5.4.60.0100.07016.29
5.4.50.0070.07716.62
5.4.40.0070.07016.49
5.4.30.0000.08316.68
5.4.20.0070.07016.59
5.4.10.0100.06316.68
5.4.00.0070.07016.04
5.3.290.0070.07714.88
5.3.280.0030.08014.68
5.3.270.0070.05714.65
5.3.260.0030.05014.67
5.3.250.0070.07014.81
5.3.240.0070.07014.78
5.3.230.0070.04314.62
5.3.220.0030.07014.64
5.3.210.0030.04014.67
5.3.200.0100.04314.64
5.3.190.0070.05314.65
5.3.180.0100.03314.86
5.3.170.0130.05714.49
5.3.160.0100.07014.86
5.3.150.0130.06714.61
5.3.140.0030.07714.77
5.3.130.0030.07714.59
5.3.120.0100.07014.63
5.3.110.0130.07014.63
5.3.100.0100.05014.20
5.3.90.0030.07014.10
5.3.80.0030.05314.07
5.3.70.0070.07013.94
5.3.60.0030.06314.09
5.3.50.0130.06013.97
5.3.40.0100.07314.01
5.3.30.0030.04714.11
5.3.20.0000.04313.85
5.3.10.0030.07313.80
5.3.00.0200.03313.69

preferences:
36.16 ms | 401 KiB | 5 Q