jim.davidson Posted July 19, 2010 Share Posted July 19, 2010 I need to change a substr of a string from \'on\' to 'on' the string could different lenght each time. I tried this $query = strtr($_SESSION['email_query'],"\'","'"); but it returns "on" and I need 'on' Any help will be appreciated Link to comment https://forums.phpfreaks.com/topic/208234-need-so-help-with-string-manipulation/ Share on other sites More sharing options...
xcandiottix Posted July 20, 2010 Share Posted July 20, 2010 It's not clear to me what you are asking. but if i had the string \'on\' i would: $string = \'on\'; $fixstring = str_replace("\", "",$string); $fixstring should = 'on' or am I missing what youre saying? Link to comment https://forums.phpfreaks.com/topic/208234-need-so-help-with-string-manipulation/#findComment-1088411 Share on other sites More sharing options...
kenrbnsn Posted July 20, 2010 Share Posted July 20, 2010 Use the stripslashes funciton: <?php $str = "\'on\'"; echo stripslashes($str); ?> Ken Link to comment https://forums.phpfreaks.com/topic/208234-need-so-help-with-string-manipulation/#findComment-1088431 Share on other sites More sharing options...
jim.davidson Posted July 20, 2010 Author Share Posted July 20, 2010 Thanks Ken, the stripslashes did it. Link to comment https://forums.phpfreaks.com/topic/208234-need-so-help-with-string-manipulation/#findComment-1088603 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.