Jump to content

Help to change string from space to +


clarencek

Recommended Posts

Hi, I'm a bit new at php and need help with some string manipulation.

I'm getting a variable out of my database with this call:  $t_city = $row['t_city'];  Basically $t_city = "New York".  What I want to do is manipulate the string such that it becomes "New+York".

I was trying this, but it doesn't seem to work:
$t_city = str_replace(\' \',\'+\',$t_city);

What am I doing wrong?
Link to comment
https://forums.phpfreaks.com/topic/13367-help-to-change-string-from-space-to/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.