I have code that reads a file, finds all scores above 60.00 and then turns the entire line red before echoing the entire file again with the changes. print_r($file); returns the following array:
[code]
Array[/code]
(
[0] => Array
(
[points] => 62.85
[name] => Carl Johnson - Angie Martinez
[entirety] => 6 62.85 90.50 A 1 2 1.97(OA) Carl Johnson - Angie Martinez
)[1] => Array ( [points] => 71.43 [name] => Ray Jones - Jackie Jones [entirety] => 8 71.43 102.86 B 1 1 1 1 2.63(OA) Ray Jones - Jackie Jones ) [2] => Array ( [points] => 62.70 [name] => Hank Williams - Peggy Bradshaw [entirety] => 4 62.70 90.29 A 2 3 1.48(OA) Hank Williams - Peggy Bradshaw )
)
Below is what I have in my foreach statement but it’s only turning the last match red (Hank Williams - Peggy Bradshaw) instead of turning ALL matched lines red. What am I doing wrong and is there a better way to do this?
[php]foreach($file as $item) {
$myline = $item[‘entirety’];
$newline = “” . $myline . ‘’;
$newphrase = str_replace($myline, $newline, $arr);
}
echo ‘
’ . implode($newphrase) . ‘’;[/php]