Skip to content

Instantly share code, notes, and snippets.

@sukharevd
Created August 12, 2012 13:22
Show Gist options
  • Save sukharevd/3331792 to your computer and use it in GitHub Desktop.
Save sukharevd/3331792 to your computer and use it in GitHub Desktop.
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