Hm that's strange it should be finding the | character in $time ? Try this: $string= "|"; $pos = strpos($time, $string); if($pos === false) echo "The String: $string was not found in the string $time"; else echo "<h1>The string was found at position: $pos</h1>"; //$time = substr_replace($time, "test", $pos); PHP: Please display output of the above so I can see what is inside $time thanks.