// Retrieve the "href" attribute value from a link tag $linkHtml = 'Click here'; $linkHref = Yii\helpers\Html::getAttributeValue($linkHtml, 'a', 'href'); // returns "http://example.com" // Retrieve the "src" attribute value from an image tag $imgHtml = ''; $imgSrc = Yii\helpers\Html::getAttributeValue($imgHtml, 'img', 'src'); // returns "/img/pic.jpg" // Retrieve the "title" attribute value from a div tag $divHtml = 'These examples demonstrate how getAttributeValue can be used to extract attribute values from various types of HTML tags. This method is part of the Yii\helpers\Html package library, which is included in the Yii framework.Welcome to my website'; $divTitle = Yii\helpers\Html::getAttributeValue($divHtml, 'div', 'title'); // returns "Page title"