PHP code example of sikessem / array-object

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

    

sikessem / array-object example snippets




use SIKessEm\ArrayObject\{
  function map,
  Type
};

class {
  // ... Describe your first object
};

$object2 = new class {
  // ... Describe your second object
};


/*
 * Your can use all PHP var types :
 * - Boolean
 * - Integer
 * - Double
 * - String
 * - Array
 * - Object
 * - Resource
 */
$map_array_object = map(Type::ARRAY, Type::OBJECT); // Create a new map of type [array => object]
$map_array_object->set($array, $object1); // Add a new association between $array and $object1
$map_array_object->set($array, $object2); // Set the old association of $array with $object2
$object = $map_array_object->get($array); // Get the object associated with $array into $object
print_r();