3v4l.org

run code in 300+ PHP versions simultaneously
<?php $curl=curl_init(); $update = '{"update_id":249657259, "message":{"message_id":469,"from":{"id":89093089,"first_name":"Yoily","username":"YoilyL"},"chat":{"id":-1001068646424,"title":"Bot test","type":"supergroup"},"date":1468506747,"voice":{"duration":1,"mime_type":"audio\/ogg","file_id":"AwADBAADyQQAAuFzTwVPB2Vyea2ZXQI","file_size":3542}}}'; $upar = json_decode($update, TRUE); $chatid = $upar['message']['chat']['id']; $mid = $upar['message']['message_id']; $mtxt = ''; $sender = $upar['message']['from']['id']; $name = $upar['message']['from']['first_name']; $isc = false; if (isset($upar['message']['entities'])){ foreach ($upar['message']['entities'] as $ent){ if ($ent['type']=='mention'){ $ment = substr($upar['message']['text'], $ent['offset'], $ent['length']); $chch = json_decode(file_get_contents("https://api.telegram.org/bot247854284:AAFrc7srTVzCVSMrxtMpQxtqLxMpbznCcPM/getChat?chat_id=$ment"), true); print_r($chch); if ($chch['ok'] && $chch['result']['type']!== 'private' && !stripos($ment, 'smartechgroup')) { $isc = true; break;} } } } if (isset($upar['message']['text'])) $mtxt = $upar['message']['text']; $link = (stripos( $mtxt, 'telegram.me')!==false && stripos($mtxt, smartechgroup, 15 )=== false); If (isset($upar['message']['new_chat_member'])) { if ( strripos($upar['message']['new_chat_member']['username'], 'bot', -3) ){ $botid = $upar['message']['new_chat_member']['id']; header('Content-Type: application/json'); echo json_encode(array( 'method'=>'kickChatMember', 'chat_id'=>$chatid, 'user_id'=>$botid, )); } else { $name = $upar['message']['new_chat_member']['first_name']; header('Content-Type: application/json'); echo json_encode(array( 'method'=>'sendMessage', 'chat_id'=>$chatid, 'text'=> "*Hi $name*, and welcome to the smartech group!\n\nWe are glad you joined our group! \n\n_Please be aware of these rules:_\n-* only English* may be used\n- discussing *only about technology *issues.\n- no voice notes\n-* no ads *(including telegram links to groups/channels)\nThank you for understanding and cooperation \n*The SmarTech Team *\n\n_(Please note: if you break any of these rules I will personally (...) remove you from this group.)_", 'parse_mode' => 'markdown', )); } } elseif ($upar['message']['chat']['type'] === 'private'){ header('Content-Type: application/json'); echo json_encode(array( 'method'=>'sendMessage', 'chat_id'=>$chatid, 'parse_mode' => 'markdown', 'text'=>'sorry, this bot can only be used in the [smartech group](https://telegram.me/smartechgroup)', )); } elseif (isset($upar['message']['voice']) || $link || $isc ){ $msg1 = "*Attention $name! %0A*this message is against the group rules.%0Aif you don't delete it within*"; $msg2 = ' seconds* you will get kicked from the group.'; $i= 15; $a = json_decode(file_get_contents("https://api.telegram.org/bot209583373:AAEADqY65IgVpjRqAG7unTDVwfGGdiUJ-oU/sendMessage?chat_id=$chatid&text=$msg1 ".$i.$msg2."&reply_to_message_id=$mid&parse_mode=markdown"), true); $botmid = $a['result']['message_id']; print_r($a); usleep(500000); for ( --$i; $i >= 0 ; $i-- ) { curl_setopt($curl, CURLOPT_URL, 'https://api.telegram.org/bot209583373:AAEADqY65IgVpjRqAG7unTDVwfGGdiUJ-oU/editMessageText?chat_id=$chatid&message_id=$botmid&&parse_mode=markdown&text=$msg1 ".$i.$msg2'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $b = json_decode(curl_exec($curl), true); print_r($b); if (!isset($b['result']['reply_to_message'])){ file_get_contents("https://api.telegram.org/bot209583373:AAEADqY65IgVpjRqAG7unTDVwfGGdiUJ-oU/editMessageText?chat_id=$chatid&message_id=$botmid&text=$name, next time you should make sure your message complies with the group rules."); break; } elseif ($i === 0){ $name = (isset($upar['message']['from']['last_name']))?"$name {$upar['message']['from']['last_name']}": $name; $c = json_decode(file_get_contents("https://api.telegram.org/bot209583373:AAEADqY65IgVpjRqAG7unTDVwfGGdiUJ-oU/kickChatMember?chat_id=$chatid&user_id=$sender"), true); $last = ($c['ok'])?"$name has been kicked because his message was against the group rules.":"$name couldn't be kicked, but his message is against group rules."; file_get_contents("https://api.telegram.org/bot209583373:AAEADqY65IgVpjRqAG7unTDVwfGGdiUJ-oU/editMessageText?chat_id=$chatid&message_id=$botmid&text=$last"); } usleep(560000); }} curl_close($curl);

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.00416.63
8.3.50.0080.00818.10
8.3.40.0040.01118.94
8.3.30.0150.00018.96
8.3.20.0040.00420.25
8.3.10.0050.00323.48
8.3.00.0080.00019.25
8.2.180.0190.00016.63
8.2.170.0210.00022.96
8.2.160.0100.00319.38
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0050.00519.45
8.2.120.0000.00826.35
8.2.110.0050.00519.42
8.2.100.0060.00617.96
8.2.90.0040.00419.01
8.2.80.0040.00417.97
8.2.70.0040.00417.75
8.2.60.0040.00418.05
8.2.50.0090.00018.10
8.2.40.0040.00420.71
8.2.30.0050.00319.35
8.2.20.0000.00717.77
8.2.10.0040.00418.12
8.2.00.0050.00318.12
8.1.280.0100.01025.92
8.1.270.0040.00424.01
8.1.260.0050.00328.09
8.1.250.0030.00628.09
8.1.240.0070.00322.80
8.1.230.0070.00417.95
8.1.220.0050.00317.75
8.1.210.0040.00418.77
8.1.200.0070.00317.35
8.1.190.0030.00517.22
8.1.180.0080.00018.10
8.1.170.0000.00918.68
8.1.160.0000.00822.18
8.1.150.0050.00320.65
8.1.140.0020.00519.56
8.1.130.0030.00517.73
8.1.120.0040.00417.49
8.1.110.0040.00417.47
8.1.100.0050.00217.44
8.1.90.0030.00517.43
8.1.80.0000.00817.34
8.1.70.0030.00617.43
8.1.60.0030.00617.57
8.1.50.0060.00317.48
8.1.40.0000.00817.51
8.1.30.0040.00417.70
8.1.20.0030.00517.59
8.1.10.0030.00517.53
8.1.00.0000.00717.54
8.0.300.0060.00318.77
8.0.290.0040.00416.88
8.0.280.0000.00718.52
8.0.270.0000.00717.32
8.0.260.0000.00917.23
8.0.250.0040.00416.97
8.0.240.0070.00017.13
8.0.230.0040.00417.00
8.0.220.0000.00817.00
8.0.210.0030.00516.95
8.0.200.0030.00316.99
8.0.190.0030.00517.07
8.0.180.0040.00416.96
8.0.170.0060.00317.01
8.0.160.0040.00416.97
8.0.150.0040.00416.92
8.0.140.0040.00416.88
8.0.130.0000.00513.46
8.0.120.0000.00817.00
8.0.110.0040.00416.99
8.0.100.0050.00216.95
8.0.90.0000.00716.91
8.0.80.0030.01316.96
8.0.70.0000.00816.93
8.0.60.0030.00517.09
8.0.50.0040.00416.89
8.0.30.0060.01517.00
8.0.20.0080.01417.41
8.0.10.0040.00417.12
8.0.00.0090.00916.82
7.4.330.0020.00215.08
7.4.320.0000.00616.58
7.4.300.0000.00716.56
7.4.290.0030.00516.57
7.4.280.0000.00816.63
7.4.270.0030.00516.64
7.4.260.0070.00016.50
7.4.250.0040.00416.45
7.4.240.0040.00416.61
7.4.230.0030.00516.50
7.4.220.0060.01516.68
7.4.210.0100.00716.64
7.4.200.0040.00416.54
7.4.160.0040.01216.46
7.4.150.0120.01317.40
7.4.140.0130.00717.86
7.4.130.0150.00616.70
7.4.120.0050.01216.52
7.4.110.0100.00716.47
7.4.100.0030.01416.61
7.4.90.0060.01216.73
7.4.80.0090.00919.39
7.4.70.0090.00916.76
7.4.60.0150.00716.73
7.4.50.0060.00916.30
7.4.40.0100.01016.54
7.4.30.0030.01316.61
7.4.00.0030.01314.98
7.3.330.0000.00513.28
7.3.320.0000.00713.26
7.3.310.0030.00316.45
7.3.300.0070.00016.36
7.3.290.0000.00816.43
7.3.280.0080.01116.43
7.3.270.0120.00617.40
7.3.260.0110.00916.60
7.3.250.0090.00916.48
7.3.240.0090.00916.53
7.3.230.0150.00616.46
7.3.210.0130.00616.49
7.3.200.0130.00316.35
7.3.190.0130.00316.42
7.3.180.0060.01416.44
7.3.170.0130.00316.50
7.3.160.0030.01316.30
7.3.10.0180.00615.82
7.3.00.0130.00916.57
7.2.330.0000.01716.71
7.2.320.0120.00616.75
7.2.310.0030.01316.58
7.2.300.0090.01216.62
7.2.290.0140.00416.54
7.2.130.0230.00816.00
7.2.120.0190.00516.35
7.2.110.0100.00716.51
7.2.100.0110.00716.04
7.2.90.0040.00816.46
7.2.80.0090.00616.58
7.2.70.0180.01116.68
7.2.60.0090.00416.46
7.2.50.0040.00716.41
7.2.40.0190.00816.16
7.2.30.0180.01116.33
7.2.20.0030.01016.54
7.2.10.0060.01316.43
7.2.00.0080.00817.81
7.1.250.0350.00315.09
7.1.200.0070.00715.68
7.1.100.0070.00717.90
7.1.70.0000.01016.70
7.1.60.0070.00719.45
7.1.50.0030.01016.61
7.1.00.0030.07322.40
7.0.200.0030.00616.54
7.0.90.0630.08020.02
7.0.80.0770.07720.05
7.0.70.0630.07020.05
7.0.60.0630.08020.09
7.0.50.0470.08720.33
7.0.40.0000.08020.08
7.0.30.0170.07320.04
7.0.20.0130.06720.08
7.0.10.0070.06320.10
7.0.00.0130.07019.95
5.6.240.0070.08320.56
5.6.230.0170.07720.60
5.6.220.0070.08020.57
5.6.210.0070.04020.71
5.6.200.0070.06720.97
5.6.190.0070.07721.04
5.6.180.0130.06721.10
5.6.170.0030.08021.12
5.6.160.0070.08321.22
5.6.150.0100.04021.16
5.6.140.0030.07321.09
5.6.130.0100.06721.10
5.6.120.0170.07021.13
5.6.110.0070.07721.02
5.6.100.0030.05021.01
5.6.90.0070.08321.06
5.6.80.0130.07020.47
5.6.70.0070.06320.46
5.6.60.0130.07320.34
5.6.50.0030.07020.46
5.6.40.0030.08020.45
5.6.30.0030.04720.49
5.6.20.0070.07320.50
5.6.10.0070.05320.50
5.6.00.0170.06720.43
5.5.380.0100.07320.46

preferences:
61.69 ms | 401 KiB | 5 Q