Schlo_50 Posted February 11, 2008 Share Posted February 11, 2008 Hey guys, I have some values pulled from a .txt file which are echo'ed out on a page. E.g Value1, Value2, Value3, Value4 What i'd like to do is get some code to highlight each output in this order: red, yellow and blue. E.g Red | Yellow | Blue | Red Value1 | Value2 | Value3 | Value4 I have so far attempted this but need some help/ideas about what to try next? $lines = file("file.txt"); //open file foreach ($lines as $line) { $data[$key] = explode("|", $line); $catname = trim($data[$key][1]); //define data needed $a = "<font style=\"background-color: red\" size=\"3\">"; //red html highlight $b = "<font style=\"background-color: yellow\" size=\"3\">"; //yellow html highlight $c = "<font style=\"background-color: blue\" size=\"3\">"; //blue html highlight $array = array($a, $b, $c); //i think i need to use a array? print '<strong>'.$catname.'</strong></font>'; // print values and html highlight Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/90503-highlight-values/ Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 Would probably be easier to use CSS for this. Link to comment https://forums.phpfreaks.com/topic/90503-highlight-values/#findComment-464019 Share on other sites More sharing options...
Schlo_50 Posted February 11, 2008 Author Share Posted February 11, 2008 Ok, but there must be a way to use php :-\ Link to comment https://forums.phpfreaks.com/topic/90503-highlight-values/#findComment-464023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.