3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Parameter Example $data = array('post_id'=>'12345','post_title'=>'A Blog post'); $target = 'single tocken id or topic name'; or $target = array('token1','token2','...'); // up to 1000 in one request */ function sendMessage($data, $target){ //FCM api URL $url = 'https://fcm.googleapis.com/fcm/send'; //api_key available in Firebase Console -> Project Settings -> CLOUD MESSAGING -> Server key $server_key = 'AIzaSyDdGQuWaop0NoJd09t4DKLi-Vdt7hQJ0pU'; $fields = array(); $fields['data'] = $data; if(is_array($target)){ $fields['registration_ids'] = $target; }else{ $fields['to'] = $target; } //header with content_type api key $headers = array( 'Content-Type:application/json', 'Authorization:key='.$server_key ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); $result = curl_exec($ch); if ($result === FALSE) { die('FCM Send Error: ' . curl_error($ch)); } curl_close($ch); return $result; } echo sendMessage(array('message' => 'lol', 'post_title' => 'LOL'), '/topics/news'); ?>

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.0140.00416.38
8.3.50.0090.00917.93
8.3.40.0090.00618.79
8.3.30.0030.01718.81
8.3.20.0060.00918.92
8.3.10.0000.00721.83
8.3.00.0000.00821.88
8.2.180.0070.01118.41
8.2.170.0190.01322.96
8.2.160.0100.00720.35
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0140.00426.16
8.2.120.0070.00021.13
8.2.110.0030.00622.07
8.2.100.0080.00317.91
8.2.90.0030.00618.16
8.2.80.0000.00817.97
8.2.70.0000.00917.93
8.2.60.0000.00719.32
8.2.50.0040.00418.10
8.2.40.0000.01020.45
8.2.30.0070.00019.40
8.2.20.0040.00418.04
8.2.10.0000.00718.03
8.2.00.0000.00717.71
8.1.270.0000.01423.88
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0040.00820.82
8.1.230.0080.00320.95
8.1.220.0040.00417.91
8.1.210.0040.00418.99
8.1.200.0060.00317.35
8.1.190.0090.00017.11
8.1.180.0040.00418.10
8.1.170.0000.00918.49
8.1.160.0030.00322.17
8.1.150.0050.00218.83
8.1.140.0070.00019.66
8.1.130.0030.00517.72
8.1.120.0040.00417.39
8.1.110.0000.00717.46
8.1.100.0000.00817.48
8.1.90.0000.00717.38
8.1.80.0000.00717.53
8.1.70.0000.00717.52
8.1.60.0040.00417.52
8.1.50.0080.00017.45
8.1.40.0000.00817.59
8.1.30.0060.00317.71
8.1.20.0080.00017.57
8.1.10.0000.00717.63
8.1.00.0040.00417.40
8.0.300.0030.00320.04
8.0.290.0000.00717.05
8.0.280.0030.00318.41
8.0.270.0030.00317.20
8.0.260.0000.00717.29
8.0.250.0030.00317.05
8.0.240.0030.00316.93
8.0.230.0050.00316.96
8.0.220.0030.00516.84
8.0.210.0040.00416.95
8.0.200.0000.00616.97
8.0.190.0030.00617.07
8.0.180.0040.00417.05
8.0.170.0030.00517.01
8.0.160.0040.00416.93
8.0.150.0000.00816.91
8.0.140.0000.00716.95
8.0.130.0040.00413.52
8.0.120.0000.00716.84
8.0.110.0070.00016.87
8.0.100.0030.00516.89
8.0.90.0080.00016.84
8.0.80.0060.01517.00
8.0.70.0040.00416.92
8.0.60.0000.00817.05
8.0.50.0050.00317.00
8.0.30.0110.00917.03
8.0.20.0090.01017.40
8.0.10.0030.00517.01
8.0.00.0060.01416.86
7.4.330.0070.00015.55
7.4.320.0000.00616.50
7.4.300.0030.00316.50
7.4.290.0070.00316.45
7.4.280.0000.00816.47
7.4.270.0060.00016.48
7.4.260.0000.00716.63
7.4.250.0000.00716.51
7.4.240.0000.00816.46
7.4.230.0030.00316.66
7.4.220.0080.00816.59
7.4.210.0070.00916.47
7.4.200.0000.00716.63
7.4.160.0090.00616.51
7.4.150.0150.00317.40
7.4.140.0130.00617.86
7.4.130.0100.01116.56
7.4.120.0100.01016.43
7.4.110.0120.00616.37
7.4.100.0080.01116.39
7.4.90.0070.01116.62
7.4.80.0070.01016.48
7.4.70.0090.00916.59
7.4.60.0060.01016.45
7.4.50.0040.01116.48
7.4.40.0070.01316.65
7.4.30.0060.01116.60
7.4.00.0060.00915.19
7.3.330.0030.00413.23
7.3.320.0030.00313.27
7.3.310.0000.00616.29
7.3.300.0030.00316.46
7.3.290.0000.00716.49
7.3.280.0100.00716.44
7.3.270.0140.00317.40
7.3.260.0130.00516.42
7.3.250.0100.00816.52
7.3.240.0130.00816.59
7.3.230.0060.01216.39
7.3.210.0130.01016.50
7.3.200.0090.01219.39
7.3.190.0090.01216.52
7.3.180.0110.00616.40
7.3.170.0090.00616.57
7.3.160.0160.00016.46
7.3.120.0070.00715.02
7.3.110.0080.01114.73
7.3.100.0030.01114.84
7.3.90.0070.01014.95
7.3.80.0030.00614.79
7.3.70.0070.01115.05
7.3.60.0030.01015.04
7.3.50.0000.01314.95
7.3.40.0090.00614.91
7.3.30.0120.00314.72
7.3.20.0150.00016.59
7.3.10.0110.00416.60
7.3.00.0060.00816.46
7.2.330.0110.00716.70
7.2.320.0120.00616.68
7.2.310.0030.01216.44
7.2.300.0070.01016.83
7.2.290.0110.01116.86
7.2.240.0000.02115.04
7.2.230.0090.00614.88
7.2.220.0000.01614.77
7.2.210.0060.00915.00
7.2.200.0040.01515.06
7.2.190.0000.01615.04
7.2.180.0060.00614.83
7.2.170.0060.00915.05
7.2.160.0090.00615.16
7.2.150.0060.00916.95
7.2.140.0040.01417.07
7.2.130.0070.00716.55
7.2.120.0100.00916.80
7.2.110.0120.00716.72
7.2.100.0080.01116.45
7.2.90.0070.01016.66
7.2.80.0080.01316.73
7.2.70.0110.00816.87
7.2.60.0120.00916.87
7.2.50.0100.00916.83
7.2.40.0090.00916.76
7.2.30.0100.00916.71
7.2.20.0140.00916.37
7.2.10.0070.00916.78
7.2.00.0050.00917.49
7.1.330.0090.00915.89
7.1.320.0100.00715.99
7.1.310.0030.01015.88
7.1.300.0130.00315.82
7.1.290.0000.01115.60
7.1.280.0050.00515.75
7.1.270.0060.01015.89
7.1.260.0060.00615.73
7.1.250.0030.01015.64
7.1.200.0070.00715.73
7.1.100.0800.01316.20
7.1.70.0040.00416.93
7.1.60.0070.00317.18
7.1.50.0200.01434.98
7.1.00.0070.07322.35
7.0.200.0040.00714.95
7.0.120.0170.05720.20
7.0.110.0130.06320.25
7.0.100.0070.06320.19
7.0.90.0170.07320.29
7.0.80.0130.07720.38
7.0.70.0100.07720.26
7.0.60.0270.04320.20
7.0.50.0430.05720.32
7.0.40.0270.05320.35
7.0.30.0300.06320.36
7.0.20.0370.06320.39
7.0.10.0230.06720.38
7.0.00.0400.05320.41
5.6.270.0200.06321.13
5.6.260.0130.05320.81
5.6.250.0200.05021.10
5.6.240.0200.07720.90
5.6.230.0100.07720.85
5.6.220.0070.08721.11
5.6.210.0200.05321.02
5.6.200.0130.08020.89
5.6.190.0130.06021.10
5.6.180.0070.06021.00
5.6.170.0100.06020.82
5.6.160.0270.06320.77
5.6.150.0170.05721.01
5.6.140.0030.06720.77
5.6.130.0070.06320.81
5.6.120.0070.06320.88
5.6.110.0070.06320.80
5.6.100.0070.06020.98
5.6.90.0030.06321.00
5.6.80.0000.06320.39
5.6.70.0100.05720.45
5.6.60.0100.05720.43
5.6.50.0130.05320.33
5.6.40.0030.06020.30
5.6.30.0170.06720.30
5.6.20.0170.05020.17
5.6.10.0130.05020.12
5.6.00.0030.06020.36

preferences:
58.62 ms | 400 KiB | 5 Q