Re: String format problem

From: Date: Wed, 31 Aug 2005 15:31:23 +0000
Subject: Re: String format problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-221653@lists.php.net to get a copy of this message
hi i have a problem when i am formating a string the problem is it converts the \n in the string to a new line here is the code <? $Text = "D:\AppServ\www\intranet\admin\store\nodirectory\sub"; $Replace = "D:\AppServ\www\intranet\admin\store"; $with = "http://localhost/bank/admin/store"; //$doc = str_replace ($Replace, $with, $Text); $doc = str_replace( '\\', '/', str_replace( $Replace, $with, $Text ) ); echo $doc; //i need $Doc to look like this http://localhost/bank/admin/store/nodirectory/sub //but it outputs http://localhost/bank/admin/store odirectory/sub
Replace your double quotes with single quotes... that is: $Text = 'D:\AppServ\www\intranet\admin\store\nodirectory\sub'; $Replace = 'D:\AppServ\www\intranet\admin\store'; $with = 'http://localhost/bank/admin/store';

« previous php.general (#221653) next »