Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (20 sloc) 0.812 kB
<?php
require("./array.php");
$collection = new ArrayCollection();
$collection->add((object) array("name" => "Vova", "age" => 16));
$collection->add((object) array("name" => "Dima", "age" => 18));
$collection->add((object) array("name" => "Vika", "age" => 23));
$collection->add((object) array("name" => "Vova", "age" => 17));
$collection->add((object) array("name" => "Vova", "age" => 16));
var_dump($collection->data());
# select all items with name "Vova"
# ArrayCollection is returned
$allVovas = $collection->where(array("name" => "Vova"));
var_dump($allVovas);
# removing from collection all "Vova" items
$collection->remove($allVovas);
var_dump($collection->data());
# get first item
var_dump($collection->first());
# get first item by pattern
var_dump($collection->first(array("age" => 23)));
Jump to Line
Something went wrong with that request. Please try again.