I wanna trace not out string with conditional statement. Instead it is not being even traced by array search methods. But I can find the element when I print it like [php]var_dump($sections[7][5]);[/php] but when I try to trace it by conditional statements I fail to extract it. all I wanna do is to return those batsmen name who are not out.
[php]<?php
ob_start();
$url = ‘http://m.cricbuzz.com/cricket-archive/scorecard/10777/1’;
$dom = new DOMDocument;
@$dom->loadHTMLFile($url);
$tds = $dom->getElementsByTagName(‘td’);
foreach ($tds as $td)
{
echo $td->nodeValue, PHP_EOL;
}
$page = ob_get_contents();
ob_end_flush();
$fp = fopen(“output.html”,“w”);
fwrite($fp,$page);
fclose($fp);
$pieces = explode(“Bowler”, file_get_contents(‘output.html’, FILE_IGNORE_NEW_LINES));
$zaq = explode("\n", $pieces[0]);
unset($zaq[0],$zaq[1],$zaq[2],$zaq[3],$zaq[4]);
for($i=0;$i<count($zaq);$i++)
{
if ($zaq[$i]==’’) { unset($zaq[$i]); echo ‘reached here… ‘; }
}
foreach($zaq as $value)
{
echo ‘
the next elemnt is… ‘.$value.’
’;
}
$sections = array_chunk($zaq, 6);
var_dump($sections[7][5]);
echo array_search(‘not out’, $sections);
print_r(array_values($sections));
print_r(array_keys($sections));
echo array_key_exists(‘not out’, $search_array);
for($i=0;$i<count($zaq);$i++)
{
echo $sections[$i][5].’
…’;
echo count($sections[$i][5]);
$as=count($sections[$i][5]);
if($sections[$i][5]==="'not out")
{
echo count($sections[$i][5]);
echo $sections[$i][5];
var_dump($sections[$i][5]);
}
}
?>
[/php]
thanks in advance