Новые книги

Книга содержит 30 тестов по 50 вопросов с ответами на знание Android. Книга предназначена для подготовки к экзаменам и собеседованиям.
The Windows Driver Model has two separate but equally important aspects. First, the core model describes the standard structure for device drivers. Second, Microsoft provides a series of bus and class drivers for common types of devices.

The core WDM model describes how device drivers are installed and started, and how they should service user requests and interact with hardware. A WDM device driver must fit into the Plug and Play (PnP) system that lets users plug in devices that can be configured in software.

Microsoft provides a series of system drivers that have all the basic functionality needed to service many standard types of device. The first type of system driver supports different types of bus, such as the Universal Serial Bus (USB), IEEE 1394 (FireWire) and Audio port devices. Other class drivers implement standard Windows facilities such as Human Input Devices (HID) and kernel streaming. Finally, the Still Image Architecture (STI) provides a framework for handling still images, scanners, etc.

These system class drivers can make it significantly easier to write some types of device driver. For example, the USB system drivers handle all the low-level communications across this bus. A well defined interface is made available to other drivers. This makes it fairly straightforward to issue requests to the USB bus.

array_keys

Учебник РНР
Назад Вперёд

array_keys

(PHP 4)

array_keys - возвращает все ключи массива.

Описание

array array_keys (array input [, mixed search_value])

array_keys() возвращает ключи, числовые и строковые, из массива ввода input.

Если специфицировано необязательное search_value, то возвращаются только ключи для данного значения. Иначе возвращаются все ключи из input.

Пример 1. array_keys()
$array = array (0 => 100, "color" => "red");
print_r(array_keys ($array));

$array = array ("blue", "red", "green", "blue", "blue");
print_r(array_keys ($array, "blue"));

$array = array ("color" => array("blue", "red", "green"), "size" => array("small", "medium", "large"));
print_r(array_keys ($array));

Вывод будет таким:

Array
(
    [0] => 0
    [1] => color
)
Array
(
    [0] => 0
    [1] => 3
    [2] => 4
)
Array
(
    [0] => color
    [1] => size
)

Примечание: эта функция была введена в PHP 4, а ниже дана реализация для использования в PHP 3.

Пример 2. Реализация array_keys() для пользователей PHP 3
function array_keys ($arr, $term="") {
    $t = array();
    while (list($k,$v) = each($arr)) {
        if ($term && $v != $term) {
            continue;
        }
        $t[] = $k;
    }
    return $t;
}

См. также array_values().


Назад Оглавление Вперёд
array_key_exists Вверхarray_map