I'm trying to do something like this:
<?php
foreach($apples as $key => $value){
print("<td class=<?php if ($myvar==$key){ print (class1);} else {print
(class2);} ?>>$value</td>");
}
?>
Hopefully, you can see what I'm trying to do, I've left out all the ' \" '
etc. Obviously the syntax isn't right at all, how exactly do I achieve
putting an if() action with a print()? Is it even possible?
regards
<?php
foreach($apples as $key => $value){
print("<td class=<?php if ($myvar==$key){ print (class1);} else {print
(class2);} ?>>$value</td>");
}
?>
Hopefully, you can see what I'm trying to do, I've left out all the ' \" '
etc. Obviously the syntax isn't right at all, how exactly do I achieve
putting an if() action with a print()? Is it even possible?
regards
Comment