PHP code example of nodusblocker / cleanphp

1. Go to this page and download the library: Download nodusblocker/cleanphp 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/ */

    

nodusblocker / cleanphp example snippets



//Include class ArrayAccessor
use NodusBlocker\CleanPhp\Accessor\ArrayAccessor;
//Initialize an array
$array = [];
//Initialization ArrayAccessor.
//Accept a character used as key separator, default '.'
$accessor = new ArrayAccessor('.');
//Set a array value
$accessor->set($array, 'a', 1);
print_r($array);

$accessor->get($array, 'a')); // return 1
$accessor->get($array, 'b'); // Don't throw error, return null
$accessor->has($array, 'a'); // return true
$accessor->has($array, 'b'); // return false
$accessor->set($array, 'b.c', 'abc');
print_r($array);

$accessor->has($array, 'b'); // return false