php - Error in Exploding variables with Specail Characters -


$html = file_get_contents('abc.com/abc'); // create document object model $dom = new domdocument(); // load html document object model @$dom->loadhtml($html); // create domxpath instance $xpath = new domxpath($dom); // elements particular id , loop through , print href attribute $elements = $xpath->query("//*[@class='f16']"); foreach ($elements $e) {   $str = $e->nodevalue; } $values = explode("a", $str); echo $values[0]; 

returns "data1 Â data2 Â data 3"

but works fine when,

$values = explode("Â", "data1 Â data2 Â  data 3"); echo $values[0]; 

returns "data1"

how solve ?

finally found it.

$values = explode(chr(194), $str); 

because encode in ansi.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -