title: Using PHP to insert a HTML tag
body: <p>I have this HTML tag (body):</p>
  
  <pre><code>&lt;body onload="startTime()" background="src/bg3.png"&gt;
  </code></pre>
  
  <p>and I was trying to change background on refresh so I replaced the HTML tag with this PHP code:</p>
  
  <pre><code>&lt;?php
      $id = rand(1, 7);
      echo "&lt;body onload=".'"'."startTime()".'"'."background=".'"'."src/bg". $id . ".png".'"'.'&gt;';
  ?&gt;
  </code></pre>
  
  <p>which returns:</p>
  
  <pre><code>&lt;body onload="startTime()" background="src/bg5.png"&gt;
  </code></pre>
  
  <p>where the number after bg is a random between 1 and 7.</p>
  
  <p>But the problem is that when I inspect element the body tag is simply:</p>
  
  <pre><code>&lt;body&gt;
  </code></pre>
  
  <p>Does PHP only allow HTML code insertion if it's being returned by a function?</p>