Using PHP 7.3/7.4 I'd like to use/create a key-value collection. I'd like to push many time the same key. Each time the value should increment (the first time the value is 1). And at the end, I need to get the key-value pairs ordered by values.
For example
$somecollection = ???
$somecollection->add('hello')
$somecollection->add('bye')
$somecollection->add('hello')
$somecollection->add('John')
$somecollection->add('bye')
$somecollection->add('hello')
should return
$ordered = $somecollection->ordered()
dump($ordered) --> ['hello' -> 3, 'bye' -> 2, 'john' ->1]
Does that allready exist?