Mailinglisten-Archive |
> Fällt Euch eine elegantere Möglichkeit ein, ein Element mit Key X
> aus Array A zu löschen, ohne eine Schleife zu verwenden, die alle
> Elemente bis auf X in ein Array B zu kopieren, und dieses dann in
> Array A zurückkopiert ?
>
Ich eigentlich war diese Funktion dafür vorgesehen:
$input = array("a", "b", "c", "d", "e");
$output = array_slice($input, 2); // returns "c", "d", and "e"
$output = array_slice($input, 2, -1); // returns "c", "d"
$output = array_slice($input, -2, 1); // returns "d"
$output = array_slice($input, 0, 3); // returns "a", "b", and "c"
--
phpArbeitsgruppe in Gruendung - Jochen Kaechelin
Stuttgarter Str.3, D-73033 Goeppingen
Tel. 07161-92 95 94, Fax 07161-92 95 98
http://www.php-arbeitsgruppe.de, mailto:info_(at)_php-arbeitsgruppe.de
php::bar PHP Wiki - Listenarchive