For testing purposes I need strings such as:
"test\x00string"
I would like to loop over the control characters (00-1F) and generate the strings automatically so I don’t have to clutter my code with 31 lines like this but don’t know how to realize that in php.
Also for testing malformed utf I might want to insert other byte sequences into strings.
For certain characters there are predefined escape sequences, which can be used in double quotes:
However, if you’re gonna loop, your best bet would be
chr():And as a one-liner: