开发者

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

I met a st开发者_如何转开发range 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) ?


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'));


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?


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜