Timber\Helper::get_object_index_by_property PHP Метод

get_object_index_by_property() публичный статический Метод

public static get_object_index_by_property ( array $array, string $key, mixed $value ) : boolean | integer
$array array
$key string
$value mixed
Результат boolean | integer
    public static function get_object_index_by_property($array, $key, $value)
    {
        if (is_array($array)) {
            $i = 0;
            foreach ($array as $arr) {
                if (is_array($arr)) {
                    if ($arr[$key] == $value) {
                        return $i;
                    }
                } else {
                    if ($arr->{$key} == $value) {
                        return $i;
                    }
                }
                $i++;
            }
        }
        return false;
    }