Skip to content

Instantly share code, notes, and snippets.

@sukharevd sukharevd/Json.php
Created Aug 12, 2012

Embed
What would you like to do?
Zend Framework Learning
<?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
You can’t perform that action at this time.