How would you do, in PHP, to open a binary file (PDF) and see if in the last byte is a x0D?
I have some PDFs which I need to be sure that have a ending x0A instead of x0D before sending it to a program.
open your file with $pdf = file_get_contents('your_file.pdf');
, then check your string with regex preg_match("/x0D$/", $pdf);
$fp = fopen($filename, 'r');
fseek($fp, -1, SEEK_END);
$lastByte = $data = fgets($fp);