public function prop(string $name, $val=null)
    {
        if ($val !== null) { // set attribute for all nodes
            foreach ($this->nodes as $node) {
                $node->$name = $val;
            }

            return $this;
        }
        // get property value for first element
        if ($name === 'outerHTML') {
            return $this->getOuterHtml();
        }
        if ($node = $this->getFirstElmNode()) {
            if (isset($node->$name)) {
                return $node->$name;
            }
        }
    }
public function prop(string $name, $val=null)
    {
        if ($val !== null) { // set attribute for all nodes
            foreach ($this->nodes as $node) {
                $node->$name = $val;
            }

            return $this;
        }
        // get property value for first element
        if ($name === 'outerHTML') {
            return $this->getOuterHtml();
        }
        if ($node = $this->getFirstElmNode()) {
            if (isset($node->$name)) {
                return $node->$name;
            }
        }
    }
public function prop ( string $ name , $ val = null ) { if ( $ val !== null ) { // set attribute for all nodes foreach ( $ this -> nodes as $ node ) { $ node -> $ name = $ val ; } return $ this ; } // get property value for first element if ( $ name === 'outerHTML' ) { return $ this -> getOuterHtml ( ) ; } if ( $ node = $ this -> getFirstElmNode ( ) ) { if ( isset ( $ node -> $ name ) ) { return $ node -> $ name ; } } }
Get the value of a property for the first element in the set of matched elements
or set one or more properties for every matched element.

@param string $name
@param string $val

@return $this|mixed|null
Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element .