PHP code example of heydon / uarray

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

    

heydon / uarray example snippets

 php
$array = new uArray("1\xfd2\xfd3\xfd4\xfd5\xfeValue 1\xfdValue 2\xfdValue 3\xfdValue 4\xfdValue 5");

$a = $array[1] // VAR<1> = 1]2]3]4]5
$a = $array[1][2] // VAR<1,2> = 2
 php
$a = new uArray();
$a[1][2] = 'example'
 php
$a = new uArray("1\xfd2\xfd3");
unset($a[2]); // or
$a[2] = '';
 php
$array = new uArray("100\xfd200\xfd300\xfd400\xfd500");

$array->ins(350, 4);
 php
$array = new uArray("100\xfd200\xfd300\xfd400\xfd500");

$array->del(3);

01: 10]20]30
02: Item 1]Item 2]Item 3
03: 100]200]300
 php
$order = array(
  10 => array(
    'title' => 'Item 1',
    'price' => 1.00,
  ),
  20 => array(
    'title' => 'Item 2',
    'price' => 2.00,
  ),
  30 => array(
    'title' => 'Item 3',
    'price' => 3.00,
  ),
);
 php
$v = new uArray('10\xfd20\xfd30\xfeItem 1\xfdItem 2\xfdItem 3\xfe100\xfd200\xfd300');
$assoc = $v->fetchAssoc(array(2,3), 1); // tell fetchAssoc() to user attribute 2 and 3 as the values and attribute 1 as the key

echo "Item: $assoc[20][2]\n"; // to access the values

$assoc[] = array(2 => 'Item 4', 3 => 400); // Which will add an new associated value and keep all the values inline.
 php
$value = new uArray('example');
$value->resetTaint(); // Resets the taint flag.
$value->isTainted(); // checks to see if the valiable has changed.