0

I want to use HTML codes in PHP codes. like this:

<?php
   if ($A == 1){
      echo "<div style="background-color:#fff;">Hi bro</div>";
   }
?> 

I have an error in styling. Please answer me❤

Kameron
  • 10,240
  • 4
  • 13
  • 26
  • 1
    You need to escape the double quotes inside the string. – Don't Panic Feb 15 '22 at 17:02
  • 1
    *"I have an error in styling"* - No, you have an error in PHP syntax. You can use single-quotes for the PHP string literal, or escape the double-quotes within your string literal, or not use a string literal at all and move the HTML to outside the PHP code, or any number of different approaches. – David Feb 15 '22 at 17:04

0 Answers0