Created
September 17, 2012 08:21
-
-
Save kriswema/3736151 to your computer and use it in GitHub Desktop.
Format JSON if PHP version is newer or equal to 5.4.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If JSON_PRETTY_PRINT is supported by json_encode(), use it. | |
if(strnatcmp(phpversion(),'5.4.0') >= 0) | |
{ | |
echo json_encode($realoutput, JSON_PRETTY_PRINT); | |
} | |
else | |
{ | |
echo json_encode($realoutput); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment