3v4l.org

run code in 300+ PHP versions simultaneously
<?php $update = file_get_contents('php://input'); $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-- ) { $b = json_decode(file_get_contents("https://api.telegram.org/bot209583373:AAEADqY65IgVpjRqAG7unTDVwfGGdiUJ-oU/editMessageText?chat_id=$chatid&message_id=$botmid&&parse_mode=markdown&text=$msg1 ".$i.$msg2), 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); }}
Output for 8.3.0 - 8.3.4
Warning: Trying to access array offset on null in /in/CgWCL on line 5 Warning: Trying to access array offset on null in /in/CgWCL on line 5 Warning: Trying to access array offset on null in /in/CgWCL on line 5 Warning: Trying to access array offset on null in /in/CgWCL on line 6 Warning: Trying to access array offset on null in /in/CgWCL on line 6 Warning: Trying to access array offset on null in /in/CgWCL on line 8 Warning: Trying to access array offset on null in /in/CgWCL on line 8 Warning: Trying to access array offset on null in /in/CgWCL on line 8 Warning: Trying to access array offset on null in /in/CgWCL on line 9 Warning: Trying to access array offset on null in /in/CgWCL on line 9 Warning: Trying to access array offset on null in /in/CgWCL on line 9 Warning: Trying to access array offset on null in /in/CgWCL on line 45 Warning: Trying to access array offset on null in /in/CgWCL on line 45 Warning: Trying to access array offset on null in /in/CgWCL on line 45
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
Warning: Trying to access array offset on value of type null in /in/CgWCL on line 5 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 5 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 5 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 6 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 6 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 8 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 8 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 8 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 9 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 9 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 9 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 45 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 45 Warning: Trying to access array offset on value of type null in /in/CgWCL on line 45
Output for 7.4.0 - 7.4.33
Notice: Trying to access array offset on value of type null in /in/CgWCL on line 5 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 5 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 5 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 6 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 6 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 8 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 8 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 8 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 9 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 9 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 9 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 45 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 45 Notice: Trying to access array offset on value of type null in /in/CgWCL on line 45
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33

preferences:
281.83 ms | 402 KiB | 326 Q