PHP code example of zer0php / storage

1. Go to this page and download the library: Download zer0php/storage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zer0php / storage example snippets


$storage = new \Zero\Storage\ArrayStorage([
  'key' => 'value',
  'keyNull' => null
]); 
// $storage = new \Zero\Storage\SessionStorage(); 

$storage->get('key'); //value
$storage->get('not-exists', 'defaultValue'); //defaultValue

$storage->key; //value
$storage['key']; //value
$storage->has('key'); //true
$storage->has('keyNull'); //false
$storage->exists('keyNull'); //true
isset($storage->key); //true
isset($storage['key']); //true

$storage->set('newKey', 'value');
$storage->newKey = value;
$storage['newKey'] = value;

$storage->has('newKey'); //true

$storage->remove('newKey');
//unset($storage->newKey);
//unset($storage['newKey']);

$storage->has('test'); //false