3v4l.org

run code in 300+ PHP versions simultaneously
#!/usr/bin/env php <?php mail('kaka001@mailinator.com','running index', 'running'); require dirname(__FILE__).'/goutte.phar'; // Last id $last_id = get_last_id(); $is_running = get_running(); if($is_running == 1) { print 'Another cron is running: '.$is_running; exit; } $server = array( 'HTTP_HOST' => 'localhost', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13', ); is_running(1); // Number download per request $count = 30; $current_id = $last_id; for($i = 0; $i <= $count; $i++) { $current_id -=1; $client = new Goutte\Client($server); $url = 'http://comment.dantri.com.vn/ListReplyCommentAjax.aspx?PageIndex=1&PageSize=2000&NewsId='.$current_id; $crawler = $client->request('GET', $url); print $url."\n"; $output = ''; $crawler->filter('div.item .middle')->each(function (Symfony\Component\DomCrawler\Crawler $node, $i) use ($current_id) { $name = $node->filter('.name .text')->text(); $date = $node->filter('.name .date')->text(); $email = $node->filter('.email')->text(); $name = mb_convert_case(str_replace(array('(', ')', '"'), '', $name), MB_CASE_TITLE, "UTF-8"); $date = str_replace(array('(', ')', '"'), '', $date); $email = strtolower($email); if (filter_var($email, FILTER_VALIDATE_EMAIL)) { $output = '"'.$current_id.'","'.$name.'","'.$email.'","'.$date.'"'."\n"; cache_output($output); } }); $output = cache_output(); print $output; if(!empty($output)) { save_csv($output); } } save_last_id($current_id); is_running(0); function cache_output($string = '') { static $output = ''; $output .= $string; return $output; } function save_csv($row) { $path = dirname(__FILE__).'/'.date('Y-m-d') . '.csv'; $fh = fopen($path, "a+"); if ($fh) { fwrite($fh, $row); } else { print 'Can not write file'; return FALSE; } fclose($fh); } function save_last_id($id) { $filename = dirname(__FILE__).'/last_id.txt'; $path = $filename; $fh = @fopen($path, "w+"); if ($fh) { @fwrite($fh, $id); } else { print 'Can not write file'; return FALSE; } @fclose($fh); } function get_last_id() { $path = dirname(__FILE__).'/last_id.txt'; $fh = @fopen($path, "r"); if ($fh) { $id = @fgets($fh); @fclose($fh); return $id; } else { print 'Can not open file'; return FALSE; } } function is_running($status = FALSE) { $path = dirname(__FILE__).'/running.txt'; $fh = @fopen($path, "w+"); if ($fh) { @fwrite($fh, $status); } else { print 'Can not write file'; return FALSE; } @fclose($fh); } function get_running() { $path = dirname(__FILE__).'/running.txt'; $fh = fopen($path, "r"); if ($fh) { $id = fgets($fh); @fclose($fh); return $id; } else { print 'Can not open file'; return FALSE; } }

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.4.10.0060.00318.01
8.3.140.0100.00716.84
8.3.130.0070.01018.66
8.3.120.0160.00320.49
8.3.110.0030.00516.83
8.3.100.0030.00616.86
8.3.90.0040.00426.77
8.3.80.0060.00317.00
8.3.70.0070.01416.58
8.3.60.0100.01018.43
8.3.50.0100.01121.14
8.3.40.0120.00619.02
8.3.30.0110.00420.17
8.3.20.0040.00420.09
8.3.10.0000.00822.02
8.3.00.0080.00022.34
8.2.260.0060.00917.03
8.2.250.0070.01316.52
8.2.240.0090.00017.09
8.2.230.0070.00320.94
8.2.220.0100.00037.54
8.2.210.0070.00026.77
8.2.200.0060.00318.54
8.2.190.0060.00916.88
8.2.180.0120.00316.75
8.2.170.0150.00022.96
8.2.160.0030.01022.08
8.2.150.0060.00324.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00420.86
8.2.110.0030.00620.99
8.2.100.0030.00717.72
8.2.90.0030.00619.16
8.2.80.0040.00417.97
8.2.70.0050.00317.50
8.2.60.0080.00017.80
8.2.50.0050.00518.10
8.2.40.0000.00820.47
8.2.30.0070.00019.42
8.2.20.0040.00417.71
8.2.10.0080.00017.65
8.2.00.0030.00617.81
8.1.310.0170.00018.45
8.1.300.0100.01016.32
8.1.290.0030.00730.84
8.1.280.0090.00625.92
8.1.270.0030.00523.99
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00621.30
8.1.230.0090.00319.05
8.1.220.0030.00517.74
8.1.210.0000.00918.77
8.1.200.0060.00317.23
8.1.190.0080.00017.40
8.1.180.0050.00318.10
8.1.170.0040.00418.54
8.1.160.0000.00722.23
8.1.150.0000.00818.56
8.1.140.0000.00817.25
8.1.130.0000.00717.80
8.1.120.0070.00017.41
8.1.110.0040.00417.36
8.1.100.0000.00817.38
8.1.90.0000.00817.23
8.1.80.0050.00217.43
8.1.70.0000.00717.35
8.1.60.0040.00417.43
8.1.50.0000.00817.52
8.1.40.0040.00417.35
8.1.30.0040.00417.51
8.1.20.0080.00017.55
8.1.10.0000.00817.61
8.1.00.0040.00417.48
8.0.300.0040.00418.77
8.0.290.0080.00016.58
8.0.280.0030.00318.45
8.0.270.0070.00017.25
8.0.260.0070.00016.87
8.0.250.0030.00316.91
8.0.240.0090.00016.97
8.0.230.0030.00317.01
8.0.220.0070.00016.92
8.0.210.0070.00016.96
8.0.200.0030.00316.99
8.0.190.0040.00417.00
8.0.180.0000.00716.87
8.0.170.0080.00016.83
8.0.160.0000.00716.93
8.0.150.0000.00716.94
8.0.140.0030.00316.86
8.0.130.0000.00613.54
8.0.120.0080.00215.22
8.0.110.0020.00715.13
8.0.100.0050.00515.15
8.0.90.0020.00615.15
8.0.80.0080.00615.20
8.0.70.0060.00315.10
8.0.60.0060.00415.20
8.0.50.0050.00415.16
8.0.30.0090.00715.86
8.0.20.0080.01016.12
8.0.10.0060.00315.29
8.0.00.0100.00415.67
7.4.330.0050.00015.04
7.4.320.0000.00616.70
7.4.300.0060.00016.68
7.4.290.0070.00016.62
7.4.280.0000.00816.50
7.4.270.0000.00816.63
7.4.260.0000.00513.38
7.4.250.0030.00614.92
7.4.240.0040.00415.52
7.4.230.0040.00414.81
7.4.220.0090.00914.99
7.4.210.0070.00715.98
7.4.200.0080.00115.08
7.4.190.0030.00514.90
7.4.180.0040.00213.41
7.4.160.0070.00514.95
7.4.150.0070.00615.38
7.4.140.0060.00716.34
7.4.130.0080.00715.45
7.4.120.0060.00915.51
7.4.110.0060.00914.92
7.4.100.0080.00714.96
7.4.90.0100.00514.97
7.4.80.0050.01016.29
7.4.70.0090.00714.89
7.4.60.0040.00914.76
7.4.50.0040.00614.84
7.4.40.0060.00817.91
7.4.30.0070.00914.81
7.4.20.0080.00313.15
7.4.10.0080.00414.18
7.4.00.0060.01014.52
7.3.330.0000.00613.46
7.3.320.0000.00613.36
7.3.310.0030.00514.87
7.3.300.0070.00214.76
7.3.290.0060.00714.81
7.3.280.0060.00815.68
7.3.270.0110.00415.39
7.3.260.0110.00214.88
7.3.250.0100.00715.32
7.3.240.0090.00514.91
7.3.230.0070.00714.81
7.3.220.0030.00613.33
7.3.210.0060.00614.99
7.3.200.0050.01116.34
7.3.190.0080.00514.99
7.3.180.0050.00714.92
7.3.170.0080.00414.95
7.3.160.0080.00414.79
7.3.150.0060.00013.26
7.3.140.0030.00313.26
7.3.130.0030.00914.02
7.3.120.0070.00814.46
7.3.110.0040.00814.04
7.3.100.0080.00214.00
7.3.90.0050.00514.17
7.3.80.0040.00613.90
7.3.70.0030.00813.96
7.3.60.0060.00514.12
7.3.50.0070.00313.75
7.3.40.0030.00613.92
7.3.30.0060.00414.04
7.3.20.0020.00915.96
7.3.10.0000.01115.76
7.3.00.0070.00316.09
7.2.340.0090.00213.33
7.2.330.0110.00514.90
7.2.320.0090.00714.97
7.2.310.0110.00515.03
7.2.300.0050.01014.90
7.2.290.0080.00814.91
7.2.280.0100.00313.22
7.2.270.0080.00413.42
7.2.260.0050.01014.23
7.2.250.0050.01014.19
7.2.240.0100.00514.12
7.2.230.0080.00714.07
7.2.220.0110.00214.05
7.2.210.0070.00714.22
7.2.200.0090.00514.15
7.2.190.0060.00714.16
7.2.180.0080.00614.12
7.2.170.0100.00314.20
7.2.160.0110.00214.09
7.2.150.0100.00515.95
7.2.140.0060.00616.13
7.2.130.0080.00516.14
7.2.120.0060.00916.19
7.2.110.0080.00416.26
7.2.100.0100.00516.15
7.2.90.0080.00916.32
7.2.80.0090.00516.17
7.2.70.0090.00716.25
7.2.60.0060.00616.41
7.2.50.0080.00516.39
7.2.40.0060.01016.08
7.2.30.0050.00816.17
7.2.20.0110.00416.31
7.2.10.0060.00816.29
7.2.00.0090.00616.91
7.1.330.0070.00614.88
7.1.320.0090.00214.93
7.1.310.0020.01014.96
7.1.300.0060.00614.96
7.1.290.0050.00814.84
7.1.280.0080.00214.87
7.1.270.0040.00914.98
7.1.260.0050.00714.93
7.1.250.0090.00515.20
7.1.240.0070.00615.21
7.1.230.0090.00514.98
7.1.220.0070.00615.15
7.1.210.0080.00615.18
7.1.200.0100.00315.32
7.1.190.0090.00615.08
7.1.180.0080.00715.09
7.1.170.0050.00815.09
7.1.160.0080.00615.22
7.1.150.0040.00915.19
7.1.140.0050.00715.12
7.1.130.0080.00615.12
7.1.120.0060.00715.14
7.1.110.0030.01115.13
7.1.100.0090.00515.94
7.1.90.0090.00615.08
7.1.80.0090.00515.21
7.1.70.0050.00715.55
7.1.60.0110.00616.12
7.1.50.0080.00920.17
7.1.40.0080.00515.21
7.1.30.0070.00815.05
7.1.20.0070.00815.13
7.1.10.0100.00515.13
7.1.00.0040.01717.01
7.0.330.0060.00814.87
7.0.320.0070.00514.85
7.0.310.0070.00614.86
7.0.300.0080.00614.95
7.0.290.0100.00414.96
7.0.280.0060.00714.92
7.0.270.0060.00715.04
7.0.260.0030.00914.87
7.0.250.0090.00514.78
7.0.240.0080.00515.09
7.0.230.0090.00414.93
7.0.220.0090.00614.85
7.0.210.0060.00914.90
7.0.200.0070.00515.35
7.0.190.0060.00614.96
7.0.180.0120.00114.77
7.0.170.0070.00815.00
7.0.160.0080.00714.85
7.0.150.0070.00714.90
7.0.140.0050.02616.68
7.0.130.0090.00514.90
7.0.120.0050.00814.92
7.0.110.0070.00614.80
7.0.100.0060.00714.80
7.0.90.0090.01216.58
7.0.80.0040.01516.53
7.0.70.0060.01516.64
7.0.60.0060.02016.57
7.0.50.0060.02116.61
7.0.40.0050.02715.28
7.0.30.0030.02615.12
7.0.20.0050.01715.21
7.0.10.0050.02515.22
7.0.00.0060.01715.11
5.6.400.0080.00213.46
5.6.390.0070.00413.62
5.6.380.0070.00713.75
5.6.370.0060.00913.74
5.6.360.0060.00513.46
5.6.350.0070.00513.70
5.6.340.0070.00613.57
5.6.330.0050.01013.68
5.6.320.0070.00613.55
5.6.310.0100.00413.71
5.6.300.0060.00713.60
5.6.290.0080.00613.66
5.6.280.0060.00513.72
5.6.270.0060.00613.70
5.6.260.0050.00713.70
5.6.250.0080.00513.63
5.6.240.0030.01815.31
5.6.230.0060.01315.41
5.6.220.0070.01315.43
5.6.210.0050.01615.38
5.6.200.0030.02715.42
5.6.190.0070.01515.44
5.6.180.0060.02315.43
5.6.170.0080.02215.53
5.6.160.0080.02415.46
5.6.150.0090.02515.46
5.6.140.0080.02315.34
5.6.130.0100.02015.36
5.6.120.0100.01615.51
5.6.110.0070.02615.50
5.6.100.0070.02615.46
5.6.90.0090.02215.38
5.6.80.0050.01715.18
5.6.70.0060.02415.27
5.6.60.0080.02315.31
5.6.50.0050.01715.23
5.6.40.0090.01415.26
5.6.30.0080.01815.30
5.6.20.0090.01715.32
5.6.10.0090.01515.24
5.6.00.0080.01915.21
5.5.380.0040.01414.42
5.5.370.0020.01514.45
5.5.360.0020.01714.47
5.5.350.0060.01814.61
5.5.340.0040.02814.61
5.5.330.0050.01514.43
5.5.320.0030.01514.47
5.5.310.0030.01614.68
5.5.300.0070.02514.48
5.5.290.0060.02314.52
5.5.280.0050.02214.44
5.5.270.0060.02314.52
5.5.260.0060.02414.66
5.5.250.0070.02414.57
5.5.240.0070.02314.34
5.5.230.0030.02514.45
5.5.220.0060.02214.42
5.5.210.0060.02214.43
5.5.200.0070.01614.35
5.5.190.0060.02414.31
5.5.180.0100.02014.38
5.5.170.0040.00712.44
5.5.160.0080.02214.36
5.5.150.0040.02414.31
5.5.140.0040.02514.29
5.5.130.0050.02514.28
5.5.120.0070.02314.27
5.5.110.0090.02214.32
5.5.100.0070.02314.30
5.5.90.0110.01814.37
5.5.80.0050.01214.26
5.5.70.0060.01514.43
5.5.60.0050.02514.44
5.5.50.0050.01614.32
5.5.40.0080.02114.36
5.5.30.0030.01914.30
5.5.20.0070.01514.40
5.5.10.0050.02014.47
5.5.00.0090.02114.41
5.4.450.0050.02413.37
5.4.440.0050.02413.43
5.4.430.0060.01613.38
5.4.420.0050.01613.45
5.4.410.0080.02013.38
5.4.400.0050.02413.41
5.4.390.0060.02313.31
5.4.380.0030.02513.31
5.4.370.0050.02413.35
5.4.360.0080.02113.32
5.4.350.0050.02213.34
5.4.340.0070.02313.42
5.4.330.0040.00711.34
5.4.320.0070.01513.35
5.4.310.0060.02213.30
5.4.300.0090.02013.26
5.4.290.0040.01413.42
5.4.280.0080.02313.37
5.4.270.0070.01913.37
5.4.260.0040.02413.34
5.4.250.0040.02513.38
5.4.240.0060.01313.29
5.4.230.0060.02213.44
5.4.220.0070.02313.30
5.4.210.0050.01613.25
5.4.200.0030.02413.39
5.4.190.0050.02113.25
5.4.180.0070.02113.34
5.4.170.0070.01613.23
5.4.160.0050.02313.35
5.4.150.0050.01413.24
5.4.140.0050.01812.67
5.4.130.0050.01912.81
5.4.120.0030.02212.72
5.4.110.0050.01912.68
5.4.100.0020.01912.73
5.4.90.0030.02412.60
5.4.80.0060.01812.73
5.4.70.0030.02212.72
5.4.60.0080.01412.71
5.4.50.0060.01412.65
5.4.40.0040.02012.76
5.4.30.0060.01212.66
5.4.20.0060.01512.71
5.4.10.0060.01812.75
5.4.00.0050.02012.51
5.3.290.0030.01412.37
5.3.280.0050.01812.17
5.3.270.0050.02312.31
5.3.260.0060.02112.29
5.3.250.0020.02312.33
5.3.240.0060.02112.27
5.3.230.0030.01912.26
5.3.220.0050.01412.19
5.3.210.0060.01912.32
5.3.200.0040.02412.26
5.3.190.0040.02412.34
5.3.180.0080.01812.28
5.3.170.0050.02212.38
5.3.160.0050.01312.32
5.3.150.0060.02212.23
5.3.140.0050.01412.25
5.3.130.0040.01412.22
5.3.120.0040.02112.37
5.3.110.0060.01712.20
5.3.100.0040.02212.14
5.3.90.0050.02012.18
5.3.80.0030.01212.21
5.3.70.0040.02312.20
5.3.60.0040.02212.19
5.3.50.0060.01012.23
5.3.40.0040.01112.04
5.3.30.0050.02212.15
5.3.20.0080.01512.00
5.3.10.0060.01912.02
5.3.00.0040.02311.95
5.2.170.0030.01311.61
5.2.160.0030.02311.63
5.2.150.0030.01111.69
5.2.140.0060.01211.67
5.2.130.0040.01211.68
5.2.120.0060.02211.66
5.2.110.0040.02211.68
5.2.100.0050.01711.59
5.2.90.0060.01111.62
5.2.80.0040.02011.57
5.2.70.0020.02611.59
5.2.60.0040.02411.57
5.2.50.0050.01211.67
5.2.40.0070.02111.66
5.2.30.0030.01311.64
5.2.20.0050.00911.54
5.2.10.0080.01811.50
5.2.00.0040.01611.55
5.1.60.0120.00911.32
5.1.50.0020.01511.36
5.1.40.0030.02011.42
5.1.30.0030.02111.34
5.1.20.0050.01911.32
5.1.10.0020.02011.35
5.1.00.0060.02011.33
5.0.50.0040.01511.23
5.0.40.0030.01811.23
5.0.30.0040.02311.23
5.0.20.0030.00911.23
5.0.10.0000.01311.23
5.0.00.0030.02111.23
4.4.90.0030.01111.23
4.4.80.0000.01111.23
4.4.70.0030.01211.23
4.4.60.0010.01011.23
4.4.50.0000.01511.23
4.4.40.0010.02011.23
4.4.30.0050.01211.23
4.4.20.0040.00911.23
4.4.10.0020.01211.23
4.4.00.0030.01311.23
4.3.110.0020.00811.23
4.3.100.0040.01111.23
4.3.90.0010.00911.23
4.3.80.0020.01711.23
4.3.70.0010.01311.23
4.3.60.0020.00711.23
4.3.50.0030.01211.23
4.3.40.0010.01611.23
4.3.30.0020.00911.23
4.3.20.0010.01411.23
4.3.10.0010.01411.23
4.3.00.0010.00911.23

preferences:
29.8 ms | 403 KiB | 5 Q