2

I'm stuck using an Apache server with an older php version. it doesn't have the function json_encode. does anybody know of a php script that can take care of this?

2

1 Answer 1

4

If it is absolutely not possible to upgrade your PHP, here are a few work arounds:

Upgrade.php - With 'upgrade.php' on-hand, you can use many features from newer PHP versions (up to 5.3/5.4 currently) without losing compatibility to older interpreters and outdated webserver setups. It takes care of emulating any functions (with their original names) that are missing at runtime. You just include() it into your application. Then you're freed from micromanaging backwards compliance and wasting time with workarounds. Simply use the more featureful PHP functions.

JSON-PHP - JSON-PHP is a PHP implementation of JSON, freely-available for download and use from pear.php.net.

Json Wrapper - jsonwrapper implements the json_encode function if it is missing, and leaves it alone if it is already present. So it is nicely future-compatible.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so very much you just made my day. The webhosting service said they are not going to upgrade anytime soon and that really puts a kink in my android app development. I am going to use json wrapper so that when they do finally upgrade I won't have to change my code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.