public function getLength()
    {
        if (!$this->container) {
            return 0;
        }

        $count = count($this->container);
        $keys = array_keys($this->container);
        return (array_keys($this->container) === range(0, $count - 1))
            ? $count
            : max($keys);
    }
public function getLength()
    {
        if (!$this->container) {
            return 0;
        }

        $count = count($this->container);
        $keys = array_keys($this->container);
        return (array_keys($this->container) === range(0, $count - 1))
            ? $count
            : max($keys);
    }
public function getLength ( ) { if ( ! $ this -> container ) { return 0 ; } $ count = count ( $ this -> container ) ; $ keys = array_keys ( $ this -> container ) ; return ( array_keys ( $ this -> container ) === range ( 0 , $ count - 1 ) ) ? $ count : max ( $ keys ) ; }
Copying JS-like .length behavior
@return integer|string
Copying JS - like . length behavior