Jump to content

[SOLVED] echo problem with double quotes " "


sebastiaandraaisma

Recommended Posts

Hi,

I try to echo out the following:

if ($timezone != "NULL") { //If a timezone is available for this country, show time
echo
"<tr>
<td><span class="style3"> Local time in echo ".$time."</span> 
</td>
</tr>"
}

I get an error because of the double quotes in class="style3"

 

I tried the following:

<?php
if ($timezone != "NULL") { //If a timezone is available for this country, show time
echo
?>
<tr>
<td><span class="style3"> Local time in <?php echo $time?></span> 
</td>
</tr>
<?php
}
?>

But still got an error.

 

My intention is to show the table cell only when var $timezone has been defined.

 

I read trough my MySQL & PHP bible but could not find the answer :)

All help is apriciated.

 

Kind regards,

Sebas.

Link to comment
https://forums.phpfreaks.com/topic/37252-solved-echo-problem-with-double-quotes/
Share on other sites

My personal preference is to jump in and out of php when needed like in the first example

 

<?php

if ($timezone != "NULL") { //If a timezone is available for this country, show time

?>

<tr>

<td><span class="style3"> Local time in echo  <?=$time ?></span>

</td>

</tr>

 

<?php } ?>

 

As long as everything else above and below this snippet of code is correct, this method should work just fine.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.