2017 © Pedro Peláez
 

library array_find

A PHP function that find element in an array by a callback.

image

kamyshev/array_find

A PHP function that find element in an array by a callback.

  • Saturday, June 9, 2018
  • by igor.kamyshev
  • Repository
  • 0 Watchers
  • 2 Stars
  • 98 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 11 % Grown

The README.md

Packagist Build Status GitHub license, (*1)

[DEPRECATED] This is no longer supported, please consider using array_actions instead., (*2)

array_find

A PHP function that find element in an array by a callback., (*3)

Installation

To get the latest version of array_find, simply require the project using Composer:, (*4)

``` shell $ composer require kamyshev/array_find, (*5)


If you do not want to use Composer, you can just `require` the `src/array_find.php` file. ## Usage To use `array_find`, simply pass an array and callback: ``` php $records = [ [ 'state' => 'IN', 'city' => 'Indianapolis', 'object' => 'School bus', ], [ 'state' => 'IN', 'city' => 'Indianapolis', 'object' => 'Manhole', ], [ 'state' => 'IN', 'city' => 'Plainfield', 'object' => 'Basketball', ], [ 'state' => 'CA', 'city' => 'San Diego', 'object' => 'Light bulb', ], [ 'state' => 'CA', 'city' => 'Mountain View', 'object' => 'Space pen', ], ]; $grouped = array_find($records, function ($state) { return $state['city'] === 'San Diego'; });

Example output:, (*6)

text Array ( [state] => CA [city] => San Diego [object] => Light bulb ), (*7)

If the element was not found, array_find returns null., (*8)

The Versions

09/06 2018

dev-master

9999999-dev https://github.com/TheNovel/array_find

A PHP function that find element in an array by a callback.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Igor Kamyshev

array find array_find

15/02 2018

v1.0

1.0.0.0 https://github.com/TheNovel/array_find

A PHP function that find element in an array by a callback.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Igor Kamyshev

array find array_find

15/02 2018

v0.1

0.1.0.0 https://github.com/TheNovel/array_find

A PHP function that find element in an array by a callback.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Igor Kamyshev

array find array_find