3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Zarkiel\Media; class Youtube{ private $videoMap = array( "13" => array("3GP", "Low Quality - 176x144"), "17" => array("3GP", "Medium Quality - 176x144"), "36" => array("3GP", "High Quality - 320x240"), "5" => array("FLV", "Low Quality - 400x226"), "6" => array("FLV", "Medium Quality - 640x360"), "34" => array("FLV", "Medium Quality - 640x360"), "35" => array("FLV", "High Quality - 854x480"), "43" => array("WEBM", "Low Quality - 640x360"), "44" => array("WEBM", "Medium Quality - 854x480"), "45" => array("WEBM", "High Quality - 1280x720"), "18" => array("MP4", "Medium Quality - 480x360"), "22" => array("MP4", "High Quality - 1280x720"), "37" => array("MP4", "High Quality - 1920x1080"), "38" => array("MP4", "High Quality - 4096x230") ); private $videoPageUrl = 'https://www.youtube.com/watch?v='; protected function getPageContent($id){ $page = $this->videoPageUrl.$id; $content = file_get_contents($page); return $content; } function getDownloadLinks($id){ $content = $this->getPageContent($id); $videos = array('MP4' => array(), 'FLV' => array(), '3GP' => array(), 'WEBM' => array()); if(preg_match('/"url_encoded_fmt_stream_map": "(.*)"/iUm', $content, $r)){ $data = $r[1]; $data = explode(',', $data); foreach($data As $cdata){ $cdata = str_replace('u0026', '&', $cdata); $cdata = explode('&', $cdata); foreach($cdata As $xdata){ if(preg_match('/^sig/', $xdata)){ $sig = substr($xdata, 4); } if(preg_match('/^url/', $xdata)){ $url = substr($xdata, 4); } if(preg_match('/^itag/', $xdata)){ $type = substr($xdata, 5); } } $url = urldecode($url).'&signature='.$sig; $videos[$this->videoMap[$type][0]][$this->videoMap[$type][1]] = $url; } } return $videos; } } $youtube = new Zarkiel\Media\Youtube(); $download_links = $youtube->getDownloadLinks('q_gfD3nvh-8'); print_r($download_links);

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.40.0080.00818.61
8.3.30.0090.00618.86
8.3.20.0040.00420.16
8.3.10.0080.00023.66
8.3.00.0050.00323.71
8.2.170.0070.00722.96
8.2.160.0100.00720.39
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00021.05
8.2.120.0040.00426.35
8.2.110.0070.00322.02
8.2.100.0070.00417.93
8.2.90.0000.00819.27
8.2.80.0000.00817.97
8.2.70.0050.00517.47
8.2.60.0050.00617.91
8.2.50.0050.00318.07
8.2.40.0040.00422.15
8.2.30.0040.00420.77
8.2.20.0000.00717.75
8.2.10.0070.00017.92
8.2.00.0050.00518.08
8.1.270.0040.00420.38
8.1.260.0060.00928.09
8.1.250.0080.00028.09
8.1.240.0050.00522.52
8.1.230.0040.00719.07
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0070.00317.11
8.1.180.0000.00718.10
8.1.170.0030.00618.51
8.1.160.0000.00720.75
8.1.150.0050.00518.71
8.1.140.0050.00319.49
8.1.130.0040.00417.58
8.1.120.0050.00317.30
8.1.110.0000.00717.38
8.1.100.0000.00717.39
8.1.90.0030.00617.38
8.1.80.0000.00817.25
8.1.70.0030.00617.24
8.1.60.0000.00817.39
8.1.50.0050.00317.46
8.1.40.0040.00417.55
8.1.30.0040.00417.54
8.1.20.0030.00617.66
8.1.10.0080.00017.62
8.1.00.0000.00717.50
8.0.300.0040.00418.77
8.0.290.0000.00716.63
8.0.280.0080.00018.34
8.0.270.0000.00717.28
8.0.260.0030.00317.14
8.0.250.0000.00816.94
8.0.240.0080.00016.88
8.0.230.0000.00716.96
8.0.220.0020.00516.82
8.0.210.0070.00016.93
8.0.200.0000.00716.90
8.0.190.0030.00617.02
8.0.180.0050.00316.98
8.0.170.0000.00816.95
8.0.160.0000.00716.84
8.0.150.0030.00616.92
8.0.140.0000.01216.90
8.0.130.0000.00813.39
8.0.120.0030.00616.76
8.0.110.0040.00416.92
8.0.100.0040.00416.85
8.0.90.0000.00716.88
8.0.80.0060.00916.98
8.0.70.0050.00316.95
8.0.60.0050.00216.86
8.0.50.0000.00816.79
8.0.30.0080.00717.10
8.0.20.0120.00617.40
8.0.10.0000.00716.79
8.0.00.0080.01316.62
7.4.330.0020.00216.70
7.4.320.0030.00316.52
7.4.300.0030.00316.48
7.4.290.0030.00316.45
7.4.280.0000.00716.45
7.4.270.0080.00016.54
7.4.260.0070.00016.45
7.4.250.0000.00816.48
7.4.240.0050.00216.58
7.4.230.0030.00316.68
7.4.220.0130.00616.49
7.4.210.0140.00716.39
7.4.200.0000.00716.65
7.4.160.0040.01116.34
7.4.150.0090.00917.40
7.4.140.0100.00817.86
7.4.130.0080.01016.54
7.4.120.0090.01216.54
7.4.110.0110.00616.53
7.4.100.0120.00616.59
7.4.90.0100.01016.59
7.4.80.0120.00919.39
7.4.70.0110.00716.52
7.4.60.0040.01116.53
7.4.50.0040.01416.61
7.4.40.0060.00916.59
7.4.30.0000.01816.74
7.4.00.0070.00714.77
7.3.330.0000.00613.31
7.3.320.0000.00613.40
7.3.310.0040.00416.38
7.3.300.0000.00716.35
7.3.290.0080.00816.33
7.3.280.0060.01316.36
7.3.270.0090.00917.40
7.3.260.0060.01016.47
7.3.250.0080.01016.30
7.3.240.0080.00916.37
7.3.230.0060.01216.43
7.3.210.0130.00316.64
7.3.200.0120.00616.36
7.3.190.0100.00616.17
7.3.180.0120.00916.41
7.3.170.0100.01316.49
7.3.160.0030.01216.21
7.2.330.0080.00816.33
7.2.320.0080.01416.43
7.2.310.0000.01616.55
7.2.300.0130.01016.66
7.2.290.0070.01116.45
7.2.60.0090.00616.95
7.2.00.0080.01218.83
7.1.200.0060.00615.29
7.1.100.0110.00017.83
7.1.70.0060.01016.95
7.1.60.0100.01619.52
7.1.50.0000.02116.89
7.1.00.0030.07722.48
7.0.200.0000.01116.84
7.0.60.0030.04020.10
7.0.50.0130.07718.00
7.0.40.0130.08019.98
7.0.30.0300.07320.09
7.0.20.0330.08020.33
7.0.10.0030.04720.33
7.0.00.0100.04720.20
5.6.280.0100.02721.19
5.6.210.0130.07720.50
5.6.200.0030.07018.14
5.6.190.0130.07020.58
5.6.180.0400.06720.45
5.6.170.0300.07720.56
5.6.160.0030.08720.52
5.6.150.0070.05718.20
5.6.140.0070.06318.18
5.6.130.0070.08718.27
5.6.120.0070.07320.98
5.6.110.0130.06721.05
5.6.100.0170.07021.00
5.6.90.0030.06321.01
5.6.80.0100.05020.44
5.5.350.0170.03720.40
5.5.340.0000.04717.95
5.5.330.0200.07020.47
5.5.320.0270.05020.28
5.5.310.0230.07320.35
5.5.300.0100.08018.02
5.5.290.0000.04718.06
5.5.280.0100.07020.93
5.5.270.0100.05020.82
5.5.260.0070.08320.90
5.5.250.0030.08720.71
5.5.240.0170.07720.19

preferences:
47.66 ms | 400 KiB | 5 Q