Is it ok to build an array with numerical keys but assign items to arbitrary key numbers?
i.e.
$test = array(23=>'first thing', 245=>'second thing');
Is it ok to build an array with numerical keys but assign items to arbitrary key numbers?
i.e.
$test = array(23=>'first thing', 245=>'second thing');
There's nothing inherently wrong with it, especially if you think of constructing one like you are to assign an ID to a value. If you're doing something like looping from for($i=0;$i<1000000;$i++)
to find the values, then yes, you might want to rethink how you're writing it.
Yep
Yes, that is an associative array and that is what makes it useful.