Re: multiarray

From: Date: Wed, 05 Mar 2003 17:31:56 +0000
Subject: Re: multiarray
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-138319@lists.php.net to get a copy of this message
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


« previous php.general (#138319) next »