<?php usekim\present\utils\arrays\ArrayUtils;$arrayUtils =ArrayUtils::from(["Apple"=>0,"Banana"=>1,"Carrot"=>2]);//Gets random key$arrayUtils->keyRandom();// output is random, so always different
Syntax
$arrayUtils->keyRandom() : int|string|null;
Return value
A random key from array. If array is empty, returns NULL.