Interpret escape characters in single quoted string
问题 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