Comparing PHP Collections

This page summarizes the projects mentioned and recommended in the original post on dev.to

JetBrains - Tell us how you use coding tools. You may win a prize!
Are you a developer or a data analyst? Share your thoughts about your coding tools in our short survey and get a chance to win prizes!
surveys.jetbrains.com
featured
Sevalla - Deploy and host your apps and databases, now with $50 credit!
Sevalla is the PaaS you have been looking for! Advanced deployment pipelines, usage-based pricing, preview apps, templates, human support by developers, and much more!
sevalla.com
featured
  1. php-generics

    PHP generics written in PHP

    If you are only using simple collections you can use array - it is very fast and requires little memory. PHP doesn't support generic syntax and IDE can't make hints about the type of objects in a collection (yet), but if you want PHP to do type checks at runtime you can test the php-generics library.

  2. JetBrains

    Tell us how you use coding tools. You may win a prize! Are you a developer or a data analyst? Share your thoughts about your coding tools in our short survey and get a chance to win prizes!

    JetBrains logo
  3. php-var-sizeof

    Function for getting size of any PHP variable in bytes

    Memory test is very simple. It creates $collection and puts Item objects into it count times. For measurement I use var_sizeof() and memory_get_usage().

  4. PHPBench

    PHP Benchmarking framework

    I used phpbench to measure performance. I think one of the big differences between all the solutions is the type checking. So I decided to try measure it. How much faster will code with/without type checking?

  5. php-collections-comparison

    https://dev.to/mrsuh/comparing-php-collections-5cca

    If you want to reproduce the tests result you can find the source code and instructions here.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • I've been loving Benchmarking lately, but the Framework does this one quirky thing with the first result of a set. Specifically, the first return is always unusually high.

    1 project | /r/laravel | 6 Dec 2023
  • Benchmark: Mezon Router is up to 196 tomes faster then Hoa Router

    3 projects | dev.to | 4 Apr 2021
  • Static vs Non-Static Closures in PHP – A Surprising Benchmark

    3 projects | dev.to | 18 Jul 2025
  • 2020 Year in Review

    1 project | dev.to | 6 Jan 2021
  • CatBench Vector Search Playground on Postgres

    1 project | news.ycombinator.com | 2 Mar 2025

Did you know that PHP is
the 14th most popular programming language
based on number of references?