Laurence Laurence - 7 months ago 48
PHP Question

Filtering things out of string

I save stuff from a api call in a database but the api returns stuff like

$string = apicallreturn();

String contains

street+40 //it contains multiple adresses but this is just a example

I want to filter out the + and get a space there:

street 40


preg_replace($whattoreplace, $replacement, $stringtosearchreplacementsin); worked

i ended up using str_replace(); sins preg_replace(); cant be called on a string if it not contains the replacement