cgm225 Posted May 29, 2008 Share Posted May 29, 2008 I want to echo: C:\public_html\media\photos\thumbnails\ However, if I try the following, it escapes the last single or double quote.. echo 'C:\public_html\media\photos\thumbnails\'; How do I echo that path? Quote Link to comment https://forums.phpfreaks.com/topic/107810-i-dont-want-to-escape-single-quote/ Share on other sites More sharing options...
MadTechie Posted May 29, 2008 Share Posted May 29, 2008 echo "C:\\public_html\\media\\photos\\thumbnails\\"; you could use addslashes Quote Link to comment https://forums.phpfreaks.com/topic/107810-i-dont-want-to-escape-single-quote/#findComment-552647 Share on other sites More sharing options...
cgm225 Posted May 29, 2008 Author Share Posted May 29, 2008 There is no better way to do that? Quote Link to comment https://forums.phpfreaks.com/topic/107810-i-dont-want-to-escape-single-quote/#findComment-552650 Share on other sites More sharing options...
DarkWater Posted May 29, 2008 Share Posted May 29, 2008 Yeah, there is. Don't use Windows. =P Quote Link to comment https://forums.phpfreaks.com/topic/107810-i-dont-want-to-escape-single-quote/#findComment-552661 Share on other sites More sharing options...
MadTechie Posted May 29, 2008 Share Posted May 29, 2008 you can use str_replace, or addslashes, if you want to display an image you shouldn't be using / anyway (thats windows servers only) \ is unix and windows so echo "C:/public_html/media/photos/thumbnails/"; should work better what are you trying to do ? Quote Link to comment https://forums.phpfreaks.com/topic/107810-i-dont-want-to-escape-single-quote/#findComment-552662 Share on other sites More sharing options...
craygo Posted May 29, 2008 Share Posted May 29, 2008 $path = addslashes('C:\public_html\media\photos\thumbnails\\'); echo stripslashes($path); Another anti windows! Windows will actually work with back slashes or forward slashes. you have to escape the last slash because it is in front of a quote Ray Quote Link to comment https://forums.phpfreaks.com/topic/107810-i-dont-want-to-escape-single-quote/#findComment-552664 Share on other sites More sharing options...
MadTechie Posted May 29, 2008 Share Posted May 29, 2008 you have to escape the last slash because it is in front of a quote Ray erm, you should escape all of them ie /t = tab $path = addslashes("C:\public_html\media\photos\thumbnails\\"); EDIT: Ahh unless you use single quotes, (missed that) Quote Link to comment https://forums.phpfreaks.com/topic/107810-i-dont-want-to-escape-single-quote/#findComment-552670 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.