Skip to content

关联数组集合 collection

Uses

php
<?php

use Leevel\Support\TypedAssociativeArray;

基本使用

php
public function testBaseUse(): void
{
    $data = [
        'h' => 'hello',
        'w' => 'world',
    ];

    $collection = new TypedAssociativeArray($data);
    static::assertSame($collection['h'], 'hello');
    static::assertSame($collection['w'], 'world');
    static::assertTrue(isset($collection['h']));
    static::assertTrue(isset($collection['w']));
}