PHPGangsta - Der praktische PHP Blog

PHP Blog von PHPGangsta


Archive for the ‘Bugfixing’ tag

Tückisches array_merge()

with 8 comments

Welches Ergebnis würdet ihr erwarten wenn ihr 2 Arrays merged?

$a = array(
    'n' => 'n',
    'o' => 'o',
    'p' => 'p',
);

$b = array(
    'x' => 'x',
    20  => 14,
    'z' => 'z',
);

$c = array_merge($a, $b);

OK, ich verrate es euch, das Ergebnis sieht so aus:

Weiterlesen »

Written by Michael Kliewe

April 18th, 2013 at 8:56 am

Posted in PHP

Tagged with ,