I want to print a grid of buttons in which the buttons gonna have specific color according to condition and i am not able to escape php in html attribute
<?php
$i=0;
$table = '<table class="table">';
foreach($rooms as $value)
{
$s = $value['Status'];
if ($i % 5 == 0)
{
$table .= '<tr><td><button class="<?=($s==0)? btn btn-primary : btn btn-danger?>">'. $value["RoomNo"] .'</button></td>';
}
else
{
$table .= '<td><button class="<?php echo ($s==0)?btn btn-primary : btn btn-danger?>">'. $value["RoomNo"] .'</button></td>';
}
$i++;
}
$table .= '</tr></table>';
?>
<?php echo $table; ?>
expected result should be like buttons should have btn primary class whose status is 0 and for the rest red