alanl1 Posted July 8, 2013 Share Posted July 8, 2013 Hi All I am doing a str_replace for different values that need to be replaced within my variable like so $datadownboxValue = str_replace(' ', '_', $datadownboxValue); $datadownboxValue = str_replace('-', '_', $datadownboxValue); $datadownboxValue = str_replace('/', '_', $datadownboxValue); can this be done easier EG all in one rather than repeat for each different value thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/279951-str_replace-help/ Share on other sites More sharing options...
Solution kicken Posted July 8, 2013 Solution Share Posted July 8, 2013 search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. $datadownboxValue = str_replace(array(' ', '-', '/'), '_', $datadownboxValue); Quote Link to comment https://forums.phpfreaks.com/topic/279951-str_replace-help/#findComment-1439856 Share on other sites More sharing options...
alanl1 Posted July 8, 2013 Author Share Posted July 8, 2013 thank you for your quick response, that has solved my problem thanks again Quote Link to comment https://forums.phpfreaks.com/topic/279951-str_replace-help/#findComment-1439857 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.