PHP code example of schnittstabil / array_some

1. Go to this page and download the library: Download schnittstabil/array_some library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

schnittstabil / array_some example snippets


use function Schnittstabil\ArraySome\array_some;

array_some(['l', 'e', 'e', 't'], 'is_string'); // => true
array_some([ 1,   3,   3,   7 ], 'is_string'); // => false


use function Schnittstabil\ArraySome\array_some_key;

array_some_key(['unicorns' => 24], 'is_string'); // => true
array_some_key([42 => 'unicorns'], 'is_string'); // => false

/**
 * Checks whether some element in the array passes the test implemented by the callback function.
 *
 * @param array    $array    The array to iterate over
 * @param callable $callback The callback function to use
 *
 * @return bool
 */
function array_some(array $array, callable $callback);

/**
 * Checks whether some key in the array passes the test implemented by the callback function.
 *
 * @param array    $array    The array to iterate over
 * @param callable $callback The callback function to use
 *
 * @return bool
 */
function array_some_key(array $array, callable $callback);