Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version | System time (s) | User time (s) | Memory (MiB) |
---|---|---|---|
8.2.5 | 0.007 | 0.007 | 19.52 |
<?php
interface ArrayKeyable {
public function toArrayKey(): string|int;
}
final class MyObject implements ArrayKeyable
{
public function __construct(
public readonly int $id,
public readonly string $name,
) {}
public function toArrayKey(): string {
return $this->name;
}
}
$objects = [];
$data = [[1, 'Jane'], [2, 'John'], [3, 'Jake'], [4, 'Jane']];
foreach($data as [$id, $name]) {
$object = new MyObject($id, $name);
$objects[$object->toArrayKey()][] = $object;
// would turn into $objects[$object][] = $object;
}
var_dump($objects);
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version | System time (s) | User time (s) | Memory (MiB) |
---|---|---|---|
8.2.5 | 0.007 | 0.007 | 19.52 |