W
W
WiNNeR_tig2020-05-11 17:17:36
PHP
WiNNeR_tig, 2020-05-11 17:17:36

Curl and file_get anomalies, zero is 4 characters?

I'll try to state the essence of the question

. I make a curl request for the file from which I make a request, I give the answer exit ('0');
Further I consider the received result through echo strlen($data_y); The result is 4 , immediately the thought that something else comes there, and not zero in the line. I check:

echo "<pre>";
echo strlen($data_y);
echo "<br>";
print_r($data_y);
echo "<br>";
var_dump($data_y);


And the result:


4
0
string(4) "0"


Sophisticated, altered to file_get_contents, but the result is the same;

I also tried to create a clean file and put exit('0'); and the result is correct


1
0
string(1) "0"


I solved the problem, tracked the sequence of include files require_once , and it turned out that after one this problem occurred, I just created a new one and transferred the contents there and the problem disappeared. In the comments they write about BOM, apparently there was a problem in it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-05-11
@WiNNeR_tig

The first 3 bytes are the BOM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question