json_encode/json_decode - returns stdClass instead of Array in PHP

前端 未结 7 2215
太阳男子
太阳男子 2020-12-04 13:54

Observe this little script:

$array = array(\'stuff\' => \'things\');
print_r($array);
//prints - Array ( [stuff] => things )
$arrayEncoded = json_encod         


        
7条回答
  •  我在风中等你
    2020-12-04 14:31

    There is also a good PHP 4 json encode / decode library (that is even PHP 5 reverse compatible) written about in this blog post: Using json_encode() and json_decode() in PHP4 (Jun 2009).

    The concrete code is by Michal Migurski and by Matt Knapp:

    • JSON-PHP / january 2005
    • Code: http://mike.teczno.com/JSON/JSON.phps
    • Pear Proposal: http://pear.php.net/pepr/pepr-proposal-show.php?id=198
    • Pear Package: http://pear.php.net/package/Services_JSON

提交回复
热议问题