Returns the value of an item in a collection or a default value in the case it does not exists
- key
- Key to search in the collection.
- coll
- Collection where search the expected key.
- default
- Default value to return in the case that the key not exists (`null` if not provided).
Extract the optional value of a collection:
<?php
use function Lambdish\Phunctional\get;
$cart = [
'price' => 100,
'money' => 'EUR',
];
return $cart['price'] - get('discount', $cart, 0);
// => 100