codeigniter - Extract value from href tag in table using php -


i have table td below. want extract value "abl" value of symbol href tag.

<td> <a href="../detail.php?symbol=abl">ace bank limited</a> </td> 

i can extract ace bank limited using $td->nodevalue; how can extract abl using php only?

try dom

$html = '<td><a href="../detail.php?symbol=abl">ace bank limited</a></td>'; $dom = new domdocument; @$dom->loadhtml($html); foreach ($dom->getelementsbytagname('a') $tag) {     $anchor = $tag->getattribute('href');      $text = explode('=', $anchor);     echo $text[1]; //abl } 

or using preg_match

preg_match('/=([^\"]+)/', $html, $matches); echo $matches[1]; //abl 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -