Re: ereg_replace

From: Date: Thu, 26 Jul 2001 02:37:12 +0000
Subject: Re: ereg_replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59668@lists.php.net to get a copy of this message
In article <079201c1151f$ec6472e0$6500000a@cicse>, cdukes@cdukes.com (Clayton Dukes) wrote: > Can someone tell me why this doesn't work? > > $home street = ereg replace (" " , "+" , $home street); > > The input is "123 happy trail" > I need the output to be "123+happy+trail" Using an ereg here is overkill. $home_street=str_replace(" ","+",$home street); As to why it's not working as-is... The syntax is fine, so it must be failing because there are no matches to replace. Either you don't have spaces in the string (could they be "&nbsp;" instead?) or you don't have a space in that match string (is it a tab instead?). -- CC

« previous php.general (#59668) next »