0) { // look for other occurrences $pl=$pos; // list of positions $p=$pos; // $x="*************************************"; $h=$haystack; while ($p>0) { $h=substr($x,0,$p).substr($h,$p); $p=rexxpos($h,$needle); if ( $p>0 ) { $n=$n+1; $pl=$pl.", ".$p; } } if ($n==1) { $txt="needle found once in haystack, position: $pl."; } else if ($n==2) { $txt="needle found twice in haystack, position(s): $pl."; } else { $txt="needle found $n times in haystack, position(s): $pl."; } } else { $txt="needle not found in haystack."; } ?> Character Matching

Haystack: ''

Needle:   ''