Skip to content

Instantly share code, notes, and snippets.

@akkunchoi
Created October 8, 2010 10:14
Show Gist options
  • Save akkunchoi/616594 to your computer and use it in GitHub Desktop.
Save akkunchoi/616594 to your computer and use it in GitHub Desktop.
<?php
// The Difference between json_encode/json_decode and Zend_Json
$arr = array('a' => 'b', 'c' => 'd');
$arrJson = json_encode($arr);
var_dump(json_decode($arrJson)); // stdClass
$arr = array('a' => 'b', 'c' => 'd');
$arrJson = Zend_Json::encode($arr);
var_dump(Zend_Json::decode($arrJson)); // array
$arr = array('a' => 'b', 'c' => 'd');
$arrJson = Zend_Json::encode($arr);
var_dump(Zend_Json::decode($arrJson, Zend_Json::TYPE_OBJECT)); // stdClass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment