Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function trim_word_left($s, array $words) {
foreach ($words as $word) {
while (($p = mb_strpos($s, $word)) === 0) {
$s = mb_substr($s, $p + mb_strlen($word));
$s = trim($s);
return $s;
$s = 'fo kerem';
var_dump(trim_word_left($s, ['fo']));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.