Created
December 13, 2015 12:01
-
-
Save krmgns/12c191beaea73a339f21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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