I need to know if there's a quickest and efficient way to display one or more images if $value == $string
For example: I have an cell which only contains 3 single string: 'r o g', if user put ro it will output <img src="red.gif"> and <img src="orange.gif"> So it could be random if user insert gr then it will display <img src="green.gif"> and <img src="red.gif">
Right now I can only think something like...
<?php $red = "<img src="red.gif">";
$orange = "<img src="orange.gif">";
if( $cell1 == $red ){ echo $red;}
if( $cell1 == $red && $orange ){ echo $orange.$red;}
etc...
This method might works but has to provide too many possibility and I believe there's a shorter and efficient to do that, but I haven't got any idea because still I'm learning PHP
if (strpos($cell1, "r") !== false) { echo "<img src=\"red.gif\">"; }etc...