This would do the trick. It's untested, but looks right to me.

// flatten source_array to destination_array
foreach ($source_Array as $key => $value)
{
        if (!is_array ($value) && $key === 'code')
        {
                $destination_Array[] = $value;
        }
        else
        {
                foreach ($value as $subkey => $subvalue)
                {
                        $destination_Array[] = $subvalue['code'];
                }
        }
}

--
Jason k Larson


Konference wrote:
Hi all,

i have o question, is there some solution how to make from multi-array
no-multi-array? :)

i need to make from multi-array this array:

$pole[] => "gk"
$pole[] => "gk-ati"
$pole[] => "gk-nvi"
$pole[] => "gk-mat"

thank you for all advices!

multi-array:
-----------

  array(2) {
    ["code"]=>
    string(2) "gk"
    ["sub"]=>
    array(3) {
      [0]=>
      array(2) {
        ["code"]=>
        string(6) "gk-ati"
        ["sub"]=>
        NULL
      }
      [1]=>
      array(2) {
        ["code"]=>
        string(6) "gk-nvi"
        ["sub"]=>
        NULL
      }
      [2]=>
      array(2) {
        ["code"]=>
        string(6) "gk-mat"
        ["sub"]=>
        NULL
      }
    }
  }

jiri.nemec at menea.cz
http://www.menea.cz
ICQ: 114651500





-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to