vbourdeix
vbourdeix

Reputation: 13

How can a var_dump return me : string(160) ""

I met a strange problem yesterday, and wondered how it could be possible. I'm making a curl request with PHP on a "webservice" returning an XML document and I var_dump the result.

What I didn't understand is that it displayed me string(160) "" which I understand this way : the variable your dumping is a string of 160 characters and is this "". For me it's as if php told me "your variable is white (it's black)".

Do you know what could make it happen (I use php 5.2.6) ?

Upvotes: 1

Views: 355

Answers (3)

I-M-JM
I-M-JM

Reputation: 15950

Check the source (view source) of web-page, you might find the answer.

I have personally ran into similar situation quite a while back.

Upvotes: 0

Brett Zamir
Brett Zamir

Reputation: 14345

I'm guessing you have only produced XML, without character data, e.g.:

var_dump('<something/>');

Try instead:

var_dump(htmlentities('<something/>'));

or, better yet, if you know the character set:

var_dump(htmlentities('<something/>', ENT_NOQUOTES, 'UTF-8'));

Upvotes: 2

Pekka
Pekka

Reputation: 449425

It could be zero-width characters like this one: Unicode Character 'ZERO WIDTH SPACE' (U+200B)

Try doing a hex dump of the string using the method described here: How can I get a hex dump of a string in PHP?

Upvotes: 1

Related Questions