“Common Array -Methoden PHP” Code-Antworten

Common Array -Methoden PHP

$colors = array("blue","green","red");

//delete element in array by value "green"
if (($key = array_search("green", $colors)) !== false) {
    unset($colors[$key]);
}
Grepper

Common Array -Methoden PHP

$key_of_max_value = array_search(max($arrCompare),$arrCompare);
Alberto Peripolli

Common Array -Methoden PHP

print_r(deep_delete_keys($arr,'country'));

function deep_delete_keys($arr, $keys) {
    if (!is_array($keys)) $keys = array($keys);
    $filteredArr = array_diff_key( $arr, array_flip( $keys ) );
    foreach ($filteredArr as &$val) {
        if (is_array($val)) {
            $val = deep_delete_keys($val, $keys);
        }
    }
    return $filteredArr;
}
Bored Bat

Common Array -Methoden PHP


<?php
$array = array(
    "foo" => "bar",
    42    => 24,
    "multi" => array(
         "dimensional" => array(
             "array" => "foo"
         )
    )
);

var_dump($array["foo"]);
var_dump($array[42]);
var_dump($array["multi"]["dimensional"]["array"]);
?>

Condemned Chicken

Ähnliche Antworten wie “Common Array -Methoden PHP”

Fragen ähnlich wie “Common Array -Methoden PHP”

Weitere verwandte Antworten zu “Common Array -Methoden PHP” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen