Returns index of last element of the array for which predicate is true. Returns -1 if none.

@param array $array
@param callable $predicate

@return int
323135
public static function lastIndexOf(array $array, callable $predicate) : int
    {
        for ($index = count($array) - 1; $index >= 0; --$index) {
            if ($predicate($array[$index])) {
                return $index;
            }
        }

        return -1;
    }
811085
protected function getPredicateFunctions($array)
    {
        $predicateFunctions = [];
        if(is_array($array))
        {
            if(isset($array['predicates']))
            {
                $predicateFunctions['predicates'] = $array['predicates'];
            } else
            {
                $predicateFunctions[key($array)] = $array[key($array)];
                $predicateFunctions = array_merge($predicateFunctions, $this->getPredicateFunctions($array[key($array)]));
            }
        }
        return $predicateFunctions;
    }
57294
public static <T> T getLastElement(final T[] array) {

    return isNotEmpty(array) ? array[array.length - 1] : null;
  }
282567
public static function getDimensionsCount(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return 0;
        }

        $dimensionsCount = 1;

        foreach ($array as $value) {
            if (is_array($value)) {
                /*
                 * I have to increment returned value, because that means we've got 1 level more (if the value is an
                 * array)
                 */
                $count = self::getDimensionsCount($value) + 1;

                if ($count > $dimensionsCount) {
                    $dimensionsCount = $count;
                }
            }
        }

        return $dimensionsCount;
    }
1219760
public static function findKey(array $arr, \Closure $predicate){
		foreach($arr as $k => $v){
			if($predicate($v, $k)){
				return $k;
			}
		}
		return null;
	}
112787
protected function getPredicatesFromPredicateFunctions($array)
    {
        $predicates = [];
        if(is_array($array))
        {
            if(isset($array['predicates']))
            {
                $predicates = $array['predicates'];
            } else
            {
                $predicates = array_merge($predicates, $this->getPredicatesFromPredicateFunctions($array[key($array)]));
            }
        }
        return $predicates;
    }
227356
function Last() {
        $items = $this->ToArray();
        $cnt = count($items);
        return $cnt > 0 ? $items[$cnt -1] : null;
    }
586444
public static function some(array $arr, \Closure $predicate){
		
		foreach($arr as $k => $v){
			if($predicate($v, $k)){
				return true;
			}
		}
		
		return false;
		
	}
1193322
protected function getSearchCount($search, array $array)
    {
        $search = $this->getPregQuote($search);

        $number = 0;
        foreach ($array as $value) {
            if (preg_match('/^'.$search.'/', $value)) {
                $number++;
            }
        }

        return $number;
    }
25908
public static function filter(array $arr, \Closure $predicate){

		$ret = array();

		foreach($arr as $k => $v){
			if($predicate($v, $k)){
				$ret[$k] = $v;
			}
		}

		return $ret;

	}
361036
public static <T> T getLast(T array[]){
        return array!=null && array.length>0 ? array[array.length-1] : null;
    }
78092
public static int lastIndexOf(short[] array, short value) {
		if (null != array) {
			for (int i = array.length - 1; i >= 0; i--) {
				if (value == array[i]) {
					return i;
				}
			}
		}
		return INDEX_NOT_FOUND;
	}
934855
public static function getLastIndex(array &$inputArray, $removeElement=false)
    {
        $arrayIndexes = array_keys($inputArray);
        return self::getLastElement($arrayIndexes, $removeElement);
    }
1293483
function findIndex (array, predicate) {
  for (let i = 0; i < array.length; i++) {
    if (predicate(array[i])) return i
  }
  return -1
}
258106
public function array_depth($array)
    {
        $max_depth = 1;
        foreach ($array as $value) {
            if (is_array($value)) {
                $depth = $this->array_depth($value) + 1;
                if ($depth > $max_depth) {
                    $max_depth = $depth;
                }
            }
        }
        return $max_depth;
    }
312581
public function index (array $array, callable $callable, $reference = false) {
		$indexed = array();

		if ($reference) {
			foreach ($array as $key => &$value) {
				$indexed[$callable($value, $key)] = &$value;
			}
		} else {
			foreach ($array as $key => $value) {
				$indexed[$callable($value, $key)] = $value;
			}
		}

		return $indexed;
	}
572316
public static function IsSingleDepth( array $array ) : bool
   {

      if ( \count( $array ) < 1 )
      {
         return false;
      }

      foreach ( $array as $v )
      {
         if ( \is_array( $v ) && \count( $v ) > 0 )
         {
            return false;
         }
      }

      return true;

   }