PHP: is JSON or XML parser faster?

后端 未结 6 2007
暗喜
暗喜 2020-12-06 16:36

I\'m building classes that interface with the Twitter API, and I\'m wondering whether PHP\'s built-in XML or JSON parser is faster? Twitter will send me the same data in eit

6条回答
  •  半阙折子戏
    2020-12-06 17:16

    The answer depends on how do you plan to use it. I mean if you will create some request and process them inside PHP script, I believe XML will be much faster. But once you considering to create and AJAX calls and later process of result you should consider using JSON, since you benefit from JavaScript automatic representation of JSON result as an objects as well it supports cross domain request with callback functions, whereas for XML you will proxy.

提交回复
热议问题