/ListDictionariesPHP

Use arrays and object in PHP as List<T> and Dictionary<T, T> in C#

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

ListDictionariesPHP

List<T> and Dictionary<T, T> in PHP

Install

You can install it on composer

composer require foxworn3365/listdictionaries

Examples

List

$list = PHPList::new("string|int", [
    "hello",
    "goodbye",
    "your name is owo"
]);

$list->where(fn($el) => strpos($el, "e"))->foreach(function ($el) {
    echo $el . PHP_EOL;
});

Result:

hello
your name is owo