Created
August 12, 2012 13:22
-
-
Save sukharevd/3331792 to your computer and use it in GitHub Desktop.
Zend Framework Learning
This file contains 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
<?php error_reporting(E_ALL & E_NOTICE); ?> | |
<?php | |
include_once "Zend/Json.php"; | |
class Book | |
{ | |
public $isbn; | |
public $title; | |
public $authors; | |
public function __construct($_isbn, $_title, array $authors) { | |
$this->isbn = $_isbn; | |
$this->title = $_title; | |
$this->authors = $authors; | |
} | |
} | |
$book = new Book('878975678979', 'Effective PHP', array ('Smith', 'Johnson')); | |
echo Zend_Json::encode($book); | |
?> | |
<br /> | |
<?php | |
include_once "Zend/Json.php"; | |
$post = array | |
( | |
"id"=> 123, | |
"title"=> 'Hello world', | |
"category"=> 'CL09', | |
"description"=> 'No description', | |
"image"=> null, | |
"author"=> 'me', | |
"views"=> 100500, | |
"date"=> null | |
); | |
echo Zend_Json::encode($post); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment