Skip to content

Instantly share code, notes, and snippets.

@TheDistantSea
Created April 26, 2012 08:41
Show Gist options
  • Save TheDistantSea/2497697 to your computer and use it in GitHub Desktop.
Save TheDistantSea/2497697 to your computer and use it in GitHub Desktop.
Implementation of strrcspn
<?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