Replace all occurrences of a string with space | Function to extract the secret message ; Replacing all occurrences of Sub in Str by empty spaces ; Removing unwanted spaces in the start and end of the string ; Driver code
< ? php function extractSecretMessage ( $ Str , $ Sub ) { $ Str = str_replace ( $ Sub , " ▁ " , $ Str ) ; return trim ( $ Str ) ; } $ Str = " LIELIEILIEAMLIECOOL " ; $ Sub = " LIE " ; echo extractSecretMessage ( $ Str , $ Sub ) ; ? >