Skip to content

Instantly share code, notes, and snippets.

@lostphilosopher
Last active August 29, 2015 14:00
Show Gist options
  • Save lostphilosopher/54d7041297a5f5f40b2a to your computer and use it in GitHub Desktop.
Save lostphilosopher/54d7041297a5f5f40b2a to your computer and use it in GitHub Desktop.
<?php
// NoDB: Build a class for creating and stroing json files, and then extracting their contents. Could be tied to prototyping framework.
$preJson = array(
'method' => 'create',
'data' => array(
'table' => 'blog',
array(
'title' => 'Lorem ipsum: Part 1',
'text' => 'See spot run. Look, see spot play 1.'
),
array(
'title' => 'Lorem ipsum: Part 2',
'text' => 'Look, see spot play 2.'
),
)
);
$json = json_encode($preJson);
$result = json_decode($json,true);
echo 'Title: '.$result['data'][0]['title'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment