Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Domenico Pontari  >  Storage  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: how to use storage class
Class: Storage
Store and retrieve variable values from files
Author: By
Last change:
Date: 2010-05-28 10:14
Size: 768 bytes
 

Contents

Class file image Download
<?php
/**
 *  @package storage
 *  @author Domenico Pontari <fairsayan@gmail.com>
 *  @copyright Copyright (c) 2009, Domenico Pontari
 *  @license http://opensource.org/licenses/bsd-license.php New and Simplified BSD licenses
 *  @version 1.0
 *
 *  This example uses jsonStorage class to store $myVar in 'data_example' folder
 *  and it displays another variable stored in 'storedVar' file
 *
 *  YOU NEED JSON PHP MODULE TO RUN THIS EXAMPLE
 */

    
require_once ('storage_json.php');
    
$myVar = array ('tryIt' => true'format' => 'json');

    
$storage = new jsonStorage ('data_example');
    
$storage->setObj ('myVar'$myVar);
    
$storedVar $storage->getObj ('storedVar');
    echo 
'Dump for storedVar: ';
    
var_dump ($storedVar);
?>