<?php
class Vehicle
{
/**
* @var float
*/
protected $fuel = 1.0;
public function __construct(float $fuel = 0)
{
$this->fuel = $fuel;
}
public function amountOfFuel(): float
{
return $ths->fuel;
}
}
$parking = [
new Vehicle(),
new Vehicle(23.4),
]
$needsFuel = array_filter($parking, function(Vehicle $car) {return $car->amountOfFuel === 0;});