News for hackers. Stuff that matters.
Re:Things to Check in PHP by xd on Wednesday July 11, 2012 @11:02AM (#4229514)
If this is the only language in your belt, please for your software's sake learn something else, widen your perspective.

Would help if you spent some time learning PHP in the first place :/ .. to preserve keys simply '+' the arrays together:

  php > define('CONST_1', '1024');
  php > define('CONST_2', '65536');
  php > print_r((array(CONST_1 => 'val1') + array(CONST_2 => 'val2')));
  Array
  (
      [1024] => val1
      [65536] => val2
  )
Also, constants have nothing to do with the problem you had, it's just the way array_merge works.

Edit: wow, just wow. The parent is voted up with miss information and I'm voted down for correcting him.

Re:Things to Check in PHP by pestaa on Wednesday July 11, 2012 @12:06PM (#4229815)
Just so you know, my comment is not upvoted, and yours is downvoted because of the tone.

"It's just the way array_merge works" is true, so true even that it applies to the whole language. Why would merging an array yield a different result than adding them together, anyway?