Laurence Laurence - 11 months ago 62
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

Answer Source

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