On Thu, Jun 19, 2008 at 8:55 PM, VamVan <vamseevan@xxxxxxxxx> wrote: > Hi, > > How to create an associative array of this kind in PHP? > > return array( > 12345 => array( > 'mail' => 'asdf@xxxxxxxx', > 'companyName' => 'Asdf Inc.', > ), > 54321 => array( > 'mail' => 'asdf@xxxxxxxx', > 'companyName' => 'Asdfu Corp.', > ), > ); > Well you have already created one. :) return array( 12345 => array( 'mail' => 'asdf@xxxxxxxx', 'companyName' => 'Asdf Inc.' ), 54321 => array( 'mail' => 'asdf@xxxxxxxx', 'companyName' => 'Asdfu Corp.' ) ); Just removed the trailing commas and reformatted a bit. ;)