PHP supports the "
data: stream wrapper" natively, so you don't have to do ugly string manipulation to get, for example, the data from a string such as
data://text/plain;base64,SSBsb3ZlIFBIUAo= and then write it to a file. Instead, you can do this:
You can also read the data into a string by simply doing this:
$data = file_get_contents('data://text/plain;base64,SSBsb3ZlIFBIUAo=');
Here is the relevant documentation, and you can see other supported wrappers (e.g.