I have a array both key
& value
are string
like
$myArr = array(
'ball'=>'zebra',
'tree'=>'plant',
'zoo'=>'animal' );
I need to sort array
by its values
and keep key
, value
association, so output would be like
$sortedArr = array(
'zoo'=>'animal',
'tree'=>'plant',
'ball'=>'zebra' );
I am looking for shortest and smartest solution to achieve this, if you have that one please share with me.