array_key_first

Supported Versions: PHP 7 >= 7.3.0, PHP 8
Gets the first key of an array
array_key_first(array $array): int|string|null
        $query $this->database->table($table);



        
$similarResults $query->where(

            
array_key_first($this->data),

            
$this->data[array_key_first($this->data)]

        )->
limit($this->show)->get();
        $similarResults $query->where(

            
array_key_first($this->data),

            
$this->data[array_key_first($this->data)]

        )->
limit($this->show)->get();



        if (
$similarResults->isNotEmpty()) {
        return array_map(

            [
$this'prepareRule'],

            
$rule,

            
array_fill((int) array_key_first($rule), count($rule), $attribute)

        );

    }
    {

        
$builder m::mock(Builder::class);



        
$key array_key_first($this->data);

        
$value $this->data[$key];



        
$builder->shouldReceive('where')->with($key$value)->andReturnSelf();