I've a problem with this code: In the array $p i have characters and i'd like to compare the elements of the array if i find different elements i save the information in an other array called $ora, but it isnt work, what's the problem?? Thank you very mych
$uri = 'http://www.site.com';
$output=file_get_contents($uri);
if (preg_match_all('/<td colspan="1"><div class="tbl_EPG_TimesColumn.*?">(.*?)<\/div><\/td>/s', $output, $posts, PREG_PATTERN_ORDER)){
$p=$posts[0];
}
$count=count($p);
$ora = array();
for ($i = 0; $i < $count; $i++) {
if ($p[$i] != $p[$i++]){
$ora = $p;
}
echo $ora." ";
}
EDIT:
$count=count($p);
$ora = array();
for ($i = 0; $i < $count-1; $i++) {
for ($j = 0; $j < $count-1; $j++) {
if ($p[$i] != $p[$i+1]){
$ora[$j] = $p[$i];
}
}
}
$count2=count($ora);
for ($j = 0; $j < $count2; $j++) {
echo $ora[$j]." ";
}
i tried it but it doesnt work, what is the wrong'??
this is the output:
11:00 PM
11:00 PM
11:00 PM
11:00 PM
11:00 PM
11:00 PM
11:00 PM
11:00 PM