src/Collection/Mutable.php
public function position(string $id): int
    {
        $i = 0;
        foreach ($this->all() as $item) {
            if ($item->id() === $id) {
                return $i;
            }

            ++$i;
        }

        return $this->notFound($id);
    }
public function position(string $id): int
    {
        $i = 0;
        foreach ($this->all() as $item) {
            if ($item->id() === $id) {
                return $i;
            }

            ++$i;
        }

        return $this->notFound($id);
    }
public function position ( string $ id ) : int { $ i = 0 ; foreach ( $ this -> all ( ) as $ item ) { if ( $ item -> id ( ) === $ id ) { return $ i ; } ++ $ i ; } return $ this -> notFound ( $ id ) ; }
Find an element position.

@param string $id

@return null|int|string
Find an element position .