- substr: documentation ( source)
- var_dump: documentation ( source)
- strpos: documentation ( source)
- preg_replace: documentation ( source)
<?php
$body = '📣shfdgkj fdsgjkhfgkj';
$body = preg_replace('(^(:mega:|📣))', '', $body);
var_dump($body);
$megas = [':mega:', '📣'];
foreach ($megas as $mega) {
if (strpos($body, $mega) === 0) {
$body = substr($body, strlen($mega));
break;
}
}
var_dump($body);