-1

Is it possible to echo within an echo statement?

I have an if statement that echos a HTML element if a condition of time is met. I want to echo echo $rows['SOMETHING']; within this echo statment. so...

   if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
          {
            echo'<div class="opening_times_times_orange"> ***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>';
          } 

          else echo '<div class="opening_times_times_red">***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>';
        ?>

I want to echo whats between the ***** but it wont allow me with the current script.

How do i fix this

if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
{ 
echo'<div class="opening_times_times_orange"> HERE </div>';
} 
else echo '<div class="opening_times_times_red"> HERE </div>';

HERE (1) echo $rows['opening_monday_from']; and echo $rows['opening_monday_to']; HERE (2) echo $rows['opening_monday_from']; and echo $rows['opening_monday_to'];

1 Answers1

0

Try this:-

if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from'])
          {
            echo'<div class="opening_times_times_orange"> *****'. $rows['opening_monday_from']. " " . "-" . " ".$rows['opening_monday_to'].' ***** </div>';
          } 

          else echo '<div class="opening_times_times_red">*****'.$rows['opening_monday_from'] . " " . "-" . " " .$rows['opening_monday_to'].' ***** </div>';
        ?>
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98