All pastes #80108 Raw Edit

again for good

public text v1 · immutable
·published 2006-07-06 02:06 UTC
rendered paste body
There is no function to count the occurences of needle in haystack, so I made my own one...
 
 <?php
 function array_match($needle, $haystack)
 {
    if( !is_array($haystack) ) return false;
    
    $i = 0;
    while( (in_array( $needle, $haystack )) != FALSE )
    {
        $i++;
        $haystack[array_search($needle, $haystack)] = md5($needle);
        reset($haystack);
    }
    
    return $i;
 }
 ?>
 
 I know it's a bit crappy, but don't ask me too much, I'm still only 13... ;)