PHP Inform

PHP Information & Web Hosting
 

PHP funtion to find all positions of needle in a string


function strposall($haystack,$needle){

$s=0; 
$i=0;

while (is_integer($i)){

$i = strpos($haystack,$needle,$s);

if (is_integer($i)) { 
$aStrPos[] = $i; 
$s = $i+strlen($needle); 


if (isset($aStrPos)) { 
return $aStrPos; 

else { 
return false; 

}