PHP Classes

File: tests/array_collection.php

Recommend this page to a friend!
  Classes of Kiril Savchev   ITE Collection   tests/array_collection.php   Download  
File: tests/array_collection.php
Role: Example script
Content type: text/plain
Description: array collection tests
Class: ITE Collection
Manage sets of arrays or objects as collections
Author: By
Last change:
Date: 7 years ago
Size: 596 bytes
 

Contents

Class file image Download
<?php

chdir
(realpath(__DIR__.'/../..'));

require_once
'./vendor/autoload.php';

use
Ite\Collection\ArrayCollection;

$collection = new ArrayCollection();
$collection->set(12);
$collection->set("A");
//var_dump($collection->toArray());
$collection->set("B");
//var_dump($collection->toArray());

$collection2 = new ArrayCollection([1,44,'asd', 5 => PHP_INT_MAX]);
$collection->merge($collection2);
var_dump($collection->toArray());
//$max = $collection->remove(PHP_INT_MAX);
//var_dump($collection->toArray(), $max);
foreach ($collection as $key => $val) {
        echo
$key.': '.$val.PHP_EOL;
}