Search code examples
phparraysarray-key

Is it ok to have numerical keys in a PHP array but not contiguous from 0?


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'); 

Solution

  • Yep