KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Having a single-quoted string: $content = '\tThis variable is not set by me.\nCannot do anything about it.\n'; I would like to inerpret/process the string as if it was double-quoted . In other words I would like to replace all the possible escape characters (not just tab and linefeed as in this example) with the real values, taking into account that backslash might be escaped as well, thus '\\n' needs to be replaced by '\n'. eval() would easily do what I need but I cannot use it. Is there some simple solution? (A similar thread that I found deals with expansion of variables in the single-quoted string while I'm after replacing escape characters.)
Tags (comma-separated)
Save Edits
Cancel