Re: String with front slashes.....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay Blanchard wrote:
I have the potential for strings where the string will contain a front
slash;

index_Foo_Communications_c/o_Bar_Enterprises_20050718

I want to use the string to name a text file

index_Foo_Communications_c/o_Bar_Enterprises_20050718.txt

but it always fails to open the file because of the front slash. I have
completely brain farted on how to escape this (perhaps only 2 hours of
sleep last night) and I cannot find what I am looking for in the manual.
addslashes? mysql_real_escape_string? nope...nope...ack. Coffee...where
is the coffee? What do you mean, "I didn't make any more?" Are you new
here?

I'd say it would be best to keep that slash out of the filename. Do a regex on the string before doing anything else....

preg_replace ( "/\//", "-", $string );

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@xxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux