It prints out the raw data inside a string or array. Especially when dealing nested arrays. It is a function I cannot live without.
When dealing JSON data return from Facebook API/Graph, print_r() can be a very powerful debugging feature especially when the returning data structure is unknown.
Here's an example of examining data returned from Facebook FQL engine:
// Get your access token ($access_token) from OAuth 2.0 procedure |
Since the returning data structure can be very "nested" (try add in location, hometown, education, ... to the query, you'll see) and uncertain, print_r() is the way to go.
P.S.: Facebook FQL will return a empty JSON data if the return data size is more than certain bytes set by Facebook.
No comments:
Post a Comment