3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace ZarkielMedia; 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 = 'http://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.60.0110.01116.63
8.3.50.0070.01118.05
8.3.40.0040.01418.92
8.3.30.0070.00718.85
8.3.20.0050.00220.25
8.3.10.0080.00023.52
8.3.00.0000.00817.63
8.2.180.0030.01316.75
8.2.170.0110.00422.96
8.2.160.0070.01320.39
8.2.150.0070.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0090.00017.50
8.2.110.0060.00321.02
8.2.100.0120.00017.80
8.2.90.0100.00019.18
8.2.80.0050.00317.97
8.2.70.0040.00417.38
8.2.60.0080.00017.93
8.2.50.0040.00418.07
8.2.40.0060.00321.07
8.2.30.0070.00020.70
8.2.20.0000.00817.59
8.2.10.0000.00718.08
8.2.00.0000.00918.08
8.1.280.0070.01425.92
8.1.270.0090.00023.79
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0110.00019.11
8.1.230.0080.00417.66
8.1.220.0070.00417.74
8.1.210.0040.00418.77
8.1.200.0090.00017.10
8.1.190.0060.00317.11
8.1.180.0080.00018.10
8.1.170.0000.00919.04
8.1.160.0030.00521.86
8.1.150.0000.00818.80
8.1.140.0080.00019.44
8.1.130.0070.00017.62
8.1.120.0030.00417.41
8.1.110.0040.00417.29
8.1.100.0000.00817.34
8.1.90.0040.00417.28
8.1.80.0040.00417.38
8.1.70.0030.00317.39
8.1.60.0040.00417.50
8.1.50.0000.00817.50
8.1.40.0080.00017.51
8.1.30.0060.00617.52
8.1.20.0050.00317.48
8.1.10.0040.00417.51
8.1.00.0030.00517.52
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0040.00418.32
8.0.270.0030.00317.13
8.0.260.0060.00017.22
8.0.250.0040.00417.00
8.0.240.0000.00716.88
8.0.230.0030.00316.98
8.0.220.0000.00716.91
8.0.210.0070.00016.92
8.0.200.0070.00016.91
8.0.190.0090.00016.99
8.0.180.0030.00516.96
8.0.170.0090.00016.84
8.0.160.0110.00016.92
8.0.150.0050.00316.88
8.0.140.0000.00716.89
8.0.130.0030.00313.36
8.0.120.0030.00616.86
8.0.110.0040.00416.90
8.0.100.0000.00816.75
8.0.90.0040.00416.99
8.0.80.0090.00916.82
8.0.70.0040.00416.73
8.0.60.0070.00016.78
8.0.50.0050.00316.92
8.0.30.0100.00717.02
8.0.20.0160.00417.40
8.0.10.0060.00316.84
8.0.00.0110.00716.65
7.4.330.0020.00215.08
7.4.320.0060.00016.41
7.4.300.0070.00016.41
7.4.290.0030.00316.38
7.4.280.0000.00816.59
7.4.270.0030.00316.50
7.4.260.0040.00416.55
7.4.250.0020.00516.39
7.4.240.0020.00616.39
7.4.230.0070.00016.57
7.4.220.0070.01016.60
7.4.210.0080.00916.50
7.4.200.0040.00416.41
7.4.160.0080.00816.47
7.4.150.0180.00417.40
7.4.140.0060.01417.86
7.4.130.0160.00316.54
7.4.120.0080.00816.43
7.4.110.0060.01616.38
7.4.100.0150.00616.46
7.4.90.0070.01016.62
7.4.80.0030.01519.39
7.4.70.0120.00316.66
7.4.60.0070.01116.34
7.4.50.0040.00416.36
7.4.40.0100.00716.45
7.4.30.0170.00016.55
7.4.20.0080.01116.29
7.4.00.0030.01015.17
7.3.330.0000.00513.34
7.3.320.0050.00013.29
7.3.310.0030.00316.44
7.3.300.0000.00716.19
7.3.290.0040.00416.22
7.3.280.0110.00916.29
7.3.270.0060.01217.40
7.3.260.0130.00616.44
7.3.250.0130.00716.46
7.3.240.0140.00616.37
7.3.230.0080.00816.39
7.3.210.0120.00916.34
7.3.200.0140.01116.43
7.3.190.0030.01316.44
7.3.180.0100.00616.36
7.3.170.0080.00816.39
7.3.160.0090.00616.48
7.3.10.0070.00716.58
7.3.00.0050.00716.52
7.2.330.0060.01216.63
7.2.320.0090.01316.29
7.2.310.0070.01116.71
7.2.300.0080.00816.66
7.2.290.0100.00716.70
7.2.130.0080.00716.72
7.2.120.0090.00316.77
7.2.110.0120.00216.77
7.2.100.0020.01116.79
7.2.90.0060.00616.87
7.2.80.0080.00716.61
7.2.70.0030.00716.87
7.2.60.0070.00416.78
7.2.50.0080.00416.78
7.2.40.0070.00716.86
7.2.30.0070.00316.63
7.2.20.0090.00416.63
7.2.10.0040.00716.80
7.2.00.0040.00917.66
7.1.250.0020.00715.57
7.1.200.0030.00715.48
7.1.100.0040.00818.17
7.1.70.0000.00717.02
7.1.60.0050.00519.43
7.1.50.0070.01016.72
7.1.00.0030.07722.47
7.0.200.0230.00914.98
7.0.60.0070.07319.88
7.0.50.0130.07317.86
7.0.40.0070.07320.13
7.0.30.0300.05320.16
7.0.20.0300.05020.30
7.0.10.0030.04320.07
7.0.00.0000.04720.08
5.6.400.0160.01215.82
5.6.280.0070.06321.11
5.6.210.0170.06720.58
5.6.200.0070.06018.26
5.6.190.0100.08720.52
5.6.180.3170.04320.52
5.6.170.0400.08320.56
5.6.160.0130.07720.44
5.6.150.0030.04018.20
5.6.140.0070.04718.21
5.6.130.0030.04018.15
5.6.120.0200.07021.02
5.6.110.0130.07721.01
5.6.100.0070.09720.96
5.6.90.0030.05021.16
5.6.80.0070.03320.54
5.5.350.4200.03720.41
5.5.340.0100.04718.07
5.5.330.0100.05020.27
5.5.320.0330.06720.29
5.5.310.0200.05320.34
5.5.300.0070.07317.95
5.5.290.0100.05017.96
5.5.280.0000.09020.90
5.5.270.0070.05720.96
5.5.260.0100.06320.79
5.5.250.0000.06720.67
5.5.240.0070.07320.32
5.4.450.0230.05019.65
5.4.440.0100.06719.47
5.4.430.0200.05019.59
5.4.420.0300.04019.63
5.4.410.0130.05719.03
5.4.400.0130.06319.15
5.4.390.0170.06019.39
5.4.380.0230.04719.36
5.4.370.0130.05319.25
5.4.360.0130.06019.27
5.4.350.0270.05318.89
5.4.340.0070.06319.25
5.4.320.0170.05319.15
5.4.310.0170.05019.25
5.4.300.0170.05019.08
5.4.290.0170.05319.25
5.4.280.0200.04719.30
5.4.270.0130.05319.36
5.4.260.0300.03319.30
5.4.250.0130.05318.86
5.4.240.0170.05319.26
5.4.230.0030.06319.14
5.4.220.0230.04719.16
5.4.210.0100.05719.14
5.4.200.0100.05719.27
5.4.190.0070.06019.24
5.4.180.0170.06019.27
5.4.170.0130.05319.12
5.4.160.0270.04319.26
5.4.150.0270.06719.22
5.4.140.0130.05716.70
5.4.130.0300.03716.52
5.4.120.0130.06316.29
5.4.110.0330.04316.53
5.4.100.0170.07016.28
5.4.90.0170.07016.64
5.4.80.0300.05016.49
5.4.70.0230.04016.60
5.4.60.0170.04716.50
5.4.50.0070.05716.59
5.4.40.0170.05016.45
5.4.30.0170.05316.45
5.4.20.0130.05016.57
5.4.10.0130.06016.58
5.4.00.0100.05716.00

preferences:
35.82 ms | 400 KiB | 5 Q