dellemot - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of dellemot.php
- <?php
- $json='{"subscription":{"id":"5794a812-baf4-4bb0-9e11-d39cefee0f66","status":"enabled","type":"channel.subscription.message","version":"1","condition":{"broadcaster_user_id":"160237115"},"transport":{"method":"webhook","callback":"https://upaji.net/event/"},"created_at":"2022-04-25T00:19:39.56458387Z","cost":0},"event":{"user_id":"188234755","user_login":"omgeek","user_name":"OMGeeK","broadcaster_user_id":"160237115","broadcaster_user_login":"pajatajna","broadcaster_user_name":"PajaTajna","message":{"text":"pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove pajataLove text na konci","emotes":[{"begin":0,"end":9,"id":"302599635"},{"begin":11,"end":20,"id":"302599635"},{"begin":22,"end":31,"id":"302599635"},{"begin":33,"end":42,"id":"302599635"},{"begin":44,"end":53,"id":"302599635"},{"begin":55,"end":64,"id":"302599635"},{"begin":66,"end":75,"id":"302599635"},{"begin":77,"end":86,"id":"302599635"},{"begin":88,"end":97,"id":"302599635"},{"begin":99,"end":108,"id":"302599635"},{"begin":110,"end":119,"id":"302599635"},{"begin":121,"end":130,"id":"302599635"},{"begin":132,"end":141,"id":"302599635"},{"begin":143,"end":152,"id":"302599635"},{"begin":154,"end":163,"id":"302599635"},{"begin":165,"end":174,"id":"302599635"},{"begin":176,"end":185,"id":"302599635"},{"begin":187,"end":196,"id":"302599635"}]},"tier":"1000","cumulative_months":14,"streak_months":0,"duration_months":0}}';
- $json = json_decode($json, true);
- function dellemot($text, $json){
- $shift = 0;
- foreach($json['event']['message']['emotes'] as $emote){
- $text = mb_substr($text, 0, $emote['begin'] - $shift) . mb_substr($text, $emote['end'] - $shift + 2);
- $shift += $emote['end'] - $emote['begin'] + 2;
- }
- return $text;
- }
- echo dellemot($json["event"]["message"]["text"], $json);
File Description
- dellemot
- PHP Code
- 16 May-2022
- 1.89 Kb
You can Share it:
Latest PHP Pastes