I'm reading from a file through 'file_get_contents'. After exploding the content, one of the elements is presented this way when I dump it:
dd($myVariable);
b"Crédito"
I've read on the internet that this is some kind of 'binary' string, related to a PHP version 6 that never existed. But I simply can not find a way to convert it to a 'regular' string.
I thought they were somehow equivalent, but I can't even use it to compare to another string. For example, none of these will ever return true:
if ($myVariable == "Crédito")
if ($myVariable === "Crédito")
if ($myVariable == b"Crédito")
if ($myVariable == (binary)"Crédito")
How can I convert it to a regular string?
For me, utf8_encode helped. hope it will help someone else also
utf8_encode($string)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With