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 = '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.70.0000.01518.30
8.3.60.0070.00716.75
8.3.50.0080.01122.03
8.3.40.0000.01518.82
8.3.30.0090.00618.83
8.3.20.0000.00720.33
8.3.10.0040.00423.66
8.3.00.0040.00417.75
8.2.190.0040.01116.63
8.2.180.0130.00316.63
8.2.170.0070.00722.96
8.2.160.0100.00720.58
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00417.63
8.2.110.0070.00322.25
8.2.100.0080.00317.91
8.2.90.0040.00419.28
8.2.80.0000.00917.97
8.2.70.0000.01317.25
8.2.60.0040.00417.91
8.2.50.0040.00418.07
8.2.40.0000.00921.11
8.2.30.0040.00420.67
8.2.20.0000.00817.66
8.2.10.0040.00418.10
8.2.00.0040.00417.95
8.1.280.0120.00925.92
8.1.270.0060.00323.96
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00322.61
8.1.230.0090.00317.55
8.1.220.0120.00017.74
8.1.210.0030.00618.77
8.1.200.0080.00017.23
8.1.190.0040.00417.35
8.1.180.0000.00918.10
8.1.170.0000.00918.96
8.1.160.0000.00721.98
8.1.150.0000.00718.81
8.1.140.0000.00819.40
8.1.130.0030.00517.54
8.1.120.0040.00417.27
8.1.110.0040.00317.20
8.1.100.0040.00417.28
8.1.90.0000.00817.26
8.1.80.0070.00017.32
8.1.70.0030.00317.41
8.1.60.0040.00417.34
8.1.50.0030.00517.42
8.1.40.0000.00917.37
8.1.30.0070.00317.68
8.1.20.0000.00817.54
8.1.10.0030.00617.61
8.1.00.0040.00417.35
8.0.300.0070.00018.77
8.0.290.0070.00016.75
8.0.280.0040.00418.41
8.0.270.0030.00317.27
8.0.260.0050.00317.10
8.0.250.0040.00316.93
8.0.240.0030.00317.00
8.0.230.0000.00716.99
8.0.220.0030.00316.92
8.0.210.0080.00016.82
8.0.200.0040.00416.88
8.0.190.0030.00616.92
8.0.180.0090.00016.84
8.0.170.0070.00016.90
8.0.160.0040.00716.95
8.0.150.0000.00716.78
8.0.140.0000.00716.86
8.0.130.0030.00313.34
8.0.120.0040.00416.87
8.0.110.0040.00416.99
8.0.100.0000.00716.96
8.0.90.0070.00016.99
8.0.80.0160.00616.87
8.0.70.0050.00316.90
8.0.60.0040.00416.86
8.0.50.0000.00817.02
8.0.30.0080.00816.97
8.0.20.0140.00717.40
8.0.10.0040.00416.86
8.0.00.0090.00816.77
7.4.330.0020.00215.08
7.4.320.0060.00016.31
7.4.300.0030.00316.62
7.4.290.0030.00316.57
7.4.280.0040.00416.39
7.4.270.0070.00316.39
7.4.260.0060.00316.57
7.4.250.0020.00516.54
7.4.240.0040.00416.45
7.4.230.0040.00416.68
7.4.220.0110.00616.37
7.4.210.0040.01016.50
7.4.200.0040.00416.27
7.4.160.0040.01216.53
7.4.150.0140.00717.40
7.4.140.0090.00917.86
7.4.130.0100.01016.51
7.4.120.0110.00816.50
7.4.110.0160.00616.70
7.4.100.0200.00316.38
7.4.90.0170.00016.45
7.4.80.0120.01219.39
7.4.70.0070.01016.56
7.4.60.0130.00316.59
7.4.50.0030.00616.52
7.4.40.0090.00616.47
7.4.30.0150.00616.33
7.4.00.0100.00314.95
7.3.330.0020.00213.31
7.3.320.0030.00313.16
7.3.310.0040.00416.23
7.3.300.0030.00516.19
7.3.290.0030.00316.27
7.3.280.0110.00516.32
7.3.270.0160.00017.40
7.3.260.0130.00616.38
7.3.250.0100.00916.36
7.3.240.0090.00816.37
7.3.230.0100.00716.39
7.3.210.0090.01116.38
7.3.200.0090.01316.35
7.3.190.0080.00816.26
7.3.180.0120.00416.40
7.3.170.0030.01416.30
7.3.160.0060.01016.38
7.2.330.0110.00716.63
7.2.320.0100.00716.64
7.2.310.0070.01016.34
7.2.300.0120.00616.72
7.2.290.0070.01016.44
7.2.80.0080.00316.45
7.2.60.0030.00916.47
7.2.00.0070.00319.41
7.1.200.0090.00315.74
7.1.100.0040.00818.17
7.1.70.0000.00717.02
7.1.60.0090.00619.43
7.1.50.0070.01416.66
7.1.00.0000.08022.33
7.0.200.0230.01014.57
7.0.60.0070.04019.97
7.0.50.0030.08717.89
7.0.40.0130.03320.15
7.0.30.0230.04720.22
7.0.20.0370.07720.23
7.0.10.0100.07720.24
7.0.00.0100.08320.22
5.6.280.0000.03721.16
5.6.210.0200.05720.60
5.6.200.0230.07318.29
5.6.190.0030.08320.57
5.6.180.3500.04020.57
5.6.170.0230.05020.42
5.6.160.0070.07720.61
5.6.150.0030.04018.17
5.6.140.0030.08318.26
5.6.130.0030.08318.13
5.6.120.0070.04321.16
5.6.110.0000.06021.01
5.6.100.0200.05721.00
5.6.90.0070.05021.04
5.6.80.0000.04320.54
5.5.350.4130.04020.44
5.5.340.0100.08317.98
5.5.330.0070.08320.49
5.5.320.0170.06720.34
5.5.310.0270.06320.37
5.5.300.0030.05018.07
5.5.290.0030.04017.95
5.5.280.0030.07720.90
5.5.270.0000.05720.79
5.5.260.0030.09020.82
5.5.250.0100.08320.64
5.5.240.0130.06720.40
5.4.450.0700.05019.58
5.4.440.0630.06019.13
5.4.430.0600.05719.60
5.4.420.0630.05019.63
5.4.410.0570.06019.25
5.4.400.0700.04319.37
5.4.390.0570.05718.87
5.4.380.0600.05018.98
5.4.370.0630.05019.37
5.4.360.0670.05018.98
5.4.350.0630.05719.30
5.4.340.0630.05019.36
5.4.320.0500.06319.15
5.4.310.0530.05719.28
5.4.300.0630.05019.27
5.4.290.0570.05319.30
5.4.280.0670.04719.36
5.4.270.0530.06019.01
5.4.260.0570.05719.14
5.4.250.0630.05319.36
5.4.240.0600.07719.36
5.4.230.0530.04719.15
5.4.220.0730.05019.30
5.4.210.0470.05318.97
5.4.200.0530.04719.25
5.4.190.0470.05319.27
5.4.180.0530.04319.12
5.4.170.0470.05318.97
5.4.160.0530.04718.96
5.4.150.0600.05318.82
5.4.140.0570.05316.45
5.4.130.0700.05016.44
5.4.120.0570.06016.32
5.4.110.0830.07716.53
5.4.100.0770.04316.51
5.4.90.0770.06316.64
5.4.80.0570.06316.27
5.4.70.0530.05716.51
5.4.60.0530.05716.60
5.4.50.0630.04316.45
5.4.40.0570.05316.59
5.4.30.0630.05316.58
5.4.20.0570.05316.63
5.4.10.0600.04716.57
5.4.00.0070.05016.00

preferences:
51.2 ms | 401 KiB | 5 Q