Parkour\Traverse::find PHP Method

find() public static method

Finds a value in the given data.
public static find ( array $data, callable $cb, mixed $default = null ) : mixed
$data array Data.
$cb callable Function to find value.
$default mixed Default value.
return mixed Value.
    public static function find(array $data, callable $cb, $default = null)
    {
        $key = self::findKey($data, $cb);
        return $key === null ? $default : $data[$key];
    }

Usage Example

 /**
  *
  */
 public function testFindDefault()
 {
     $this->assertEquals('default', Traverse::find([], function () {
     }, 'default'));
 }