Hallo!
Gibt es eine einfache Möglichkeit eine Array ab einer bestimmten Position aufzuteilen?
$foo = array(
'aa' => 'bmw',
'bb' => 'audi',
'cc' => 'opel',
'dd' => 'Benz',
'ee' => 'Toyota',
'ff' => 'Corsa',
'gg' => 'Skoda',
'hh' => 'Volvo',
'ii' => 'Seat',
'jj' => 'Fiat',
'kk' => 'Vw',
'll' => 'Kia'
);
Nun möchte ich zu einem die Paramter VOR dem 'hh' => 'Volvo' und NACH dem einsammeln. Ich suche nach einer array Function, gibt es sowas.
Lösungsansatz:
	
Problem, wie bekomme ich die Daten nach dem key 'hh'?
Danke
					Gibt es eine einfache Möglichkeit eine Array ab einer bestimmten Position aufzuteilen?
$foo = array(
'aa' => 'bmw',
'bb' => 'audi',
'cc' => 'opel',
'dd' => 'Benz',
'ee' => 'Toyota',
'ff' => 'Corsa',
'gg' => 'Skoda',
'hh' => 'Volvo',
'ii' => 'Seat',
'jj' => 'Fiat',
'kk' => 'Vw',
'll' => 'Kia'
);
Nun möchte ich zu einem die Paramter VOR dem 'hh' => 'Volvo' und NACH dem einsammeln. Ich suche nach einer array Function, gibt es sowas.
Lösungsansatz:
PHP-Code:
	
	
        foreach ($foo as $code => $name) {
            if ($code !== 'hh') {
                $foo1[] = array(
                    'type' => $name,
                    'code' => $code
                );
            } else {
                break;
            }
        } 
Danke
 
          


 
							
						 
							
						 
							
						
Kommentar