Created
April 26, 2012 08:41
-
-
Save TheDistantSea/2497697 to your computer and use it in GitHub Desktop.
Implementation of strrcspn
This file contains 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 strrcspn($str1, $str2, $start = -1) { | |
$len = strlen($str1); | |
$start = ($start + $len) % $len; | |
for ($i = $start; $i >= 0; --$i) { | |
if (strpos($str2, $str1[$i]) !== false) { | |
return $start - $i; | |
} | |
} | |
return $start + 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment