title: How to write class attribute for html element in php file?
body: <p>Cannot write class attribute in php file for html element.
  Here is my code </p>
  
  <pre><code>echo '&lt;div&gt;&lt;p class="'.($value-&gt;getIsRequire() == 1) ? 'required' : ''.'"&gt;
  &lt;/p&gt; &lt;input type="text" name="field" id="option-value" /&gt;&lt;/div&gt;';
  </code></pre>
  
  <p>My output should be if the condition is true the class should be required otherwise the class should be empty but i got output as required text instead of input box.</p>
  
  <p><strong>Result I got is</strong></p>
  
  <p><a href="https://i.stack.imgur.com/DP48k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DP48k.png" alt="enter image description here"></a></p>