Overview

Namespaces

  • Jyxo
    • Beholder
      • TestCase
    • Gettext
      • Parser
    • Input
      • Chain
      • Filter
      • Validator
    • Mail
      • Email
        • Attachment
      • Parser
      • Sender
    • Rpc
      • Json
      • Xml
    • Shell
    • Spl
    • Svn
    • Time
    • Webdav
  • PHP

Classes

  • ArrayUtil
  • CountableLimitIterator
  • FilterIterator
  • MapIterator
  • Object
  • ObjectCache

Interfaces

  • ArrayCopy
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated

Class ArrayUtil

Utilities for working with arrays.

Namespace: Jyxo\Spl
Category: Jyxo
Package: Jyxo\Spl
Copyright: Copyright (c) 2005-2011 Jyxo, s.r.o.
License: https://github.com/jyxo/php/blob/master/license.txt
Author: Jakub Tománek
Located at Spl/ArrayUtil.php
Methods summary
public static array
# range( mixed $low, mixed $high, Closure $step, Closure $compare = null )

Creates an array containing item range. Similar to range() but with closures. Params $low and $high are inclusive. If $low > $high, resulting array will be in descending order.

Creates an array containing item range. Similar to range() but with closures. Params $low and $high are inclusive. If $low > $high, resulting array will be in descending order.

Parameters

$low
mixed
Minimal value
$high
mixed
Maximal value
$step
Closure
Closure which creates next value from current
$compare
Closure
comparing closure for detecting if we're at the end of the range (Optional)

Returns

array
public static array
# keymap( Traversable $traversable, Closure $key, Closure $value = null )

Creates an associative array from iterator which doesn't return proper keys. Keys are generated by applying callback $key to the current value. It is also possible to apply another callback directly to the value. Key callback is called BEFORE value callback.

Creates an associative array from iterator which doesn't return proper keys. Keys are generated by applying callback $key to the current value. It is also possible to apply another callback directly to the value. Key callback is called BEFORE value callback.

Example:

$data = \Jyxo\Spl\ArrayUtil::keymap($iterator, function(Object $object) {
  return $object->getId();
});

Parameters

$traversable
Traversable
Iterator
$key
Closure
Closure for generating keys
$value
Closure
Closure for modifying data (Optional)

Returns

array
Jyxo PHP Library API documentation generated by ApiGen 2.3.0