Returns the key of an item value in a collection or a default value in the case it does not exists
- value
- Value to search in the collection.
- coll
- Collection where search the expected value.
- default
- Default value to return in the case that the value not exists (`null` if not provided).
Extract the optional value of a collection:
<?php
use function Lambdish\Phunctional\key;
$map = [
'discount_1' => 10,
'discount_2' => 25,
'discount_3' => 50,
'discount_4' => 75,
];
return key(25, $map, 0);
// => discount_2