How do I know if a file is binary?

How do I know if a file is binary?

That is … I have two Excel files in the folder, one has a text format, and the other is also xls, but binary, that is, roughly speaking, scribbles open through NotePad++.

And there is a task, how to determine what is binary and what is text:?


Answer 1, authority 100%

You can use the function
string mime_content_type (string filename)
It will show the MIME type of the file (Excel files have the type application/x-msexcel, I think.


Answer 2

I haven’t tried it myself, but what if I check it

is_binary(file_get_contents(__))