Say we have a $towns array:
[
{
town: "Easton",
customers: 5
}, {
town: "Andover",
customers: 9
}
]
The following
$result = F\filter($towns, function($town) {
return $town->customers > 5;
});
returns an array of items keyed by the original position:
{
1: {
town: "Andover",
customers: 9
}
}
but comparing greater than -1
$result = F\filter($towns, function($town) {
return $town->customers > -1;
});
returns the expected structure
[
{
town: "Easton",
customers: 5
}, {
town: "Andover",
customers: 9
}
]
Any thoughts?
Say we have a
$townsarray:The following
returns an array of items keyed by the original position:
but comparing greater than
-1returns the expected structure
Any thoughts?