title: Printing review stars and making it dynamic using PHP
body: <p>I am trying to automate an HTML code with PHP. My task is to print the review stars--that are used on Amazon and many other sites for counting the average rating. 
  What I am trying to achive is this kind of pattern. </p>
  
  <blockquote>
    <p>Name:<br> Ratings:<br> Desciption:<br></p>
  </blockquote>
  
  <p>And to achieve this I am using a foreach loop to print the values from array. I have no problem whatsoever with Name and Description, but I am facing problems printing the review stars according to the count that I get from the array using foreach. <br>
  I have this HTML Code, which prints stars.</p>
  
  <pre><code>&lt;ul class="review-rating star-rating"&gt;
  &lt;li&gt;&lt;span class="fa fa-1x fa-star"&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>The above HTML will print 1 star.</p>
  
  <pre><code>    &lt;ul class="review-rating star-rating"&gt;
      &lt;li&gt;&lt;span class="fa fa-1x fa-star"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span class="fa fa-1x fa-star"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span class="fa fa-1x fa-star-half-empty"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span class="fa fa-1x fa-star-o"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span class="fa fa-1x fa-star-o"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>This above HTML will print 2.5 stars. </p>
  
  <p>Now, I want this HTML to be automated according to the count value that I get from PHP. Suppose for a particular array, I get the count as 3. So, without having to write this HTML code in 5 lines, how can I automate it in PHP. 
  One method that I thought was use 9 if statements: 5 for full stars, 4 for half(1.5,2.5,3.5,4.5). But that again is a tedious task. </p>
  
  <p>Another option is to automate it in JQuery, which again is a problem because the frontend developer won't do that. </p>
  
  <p>So, I am trying to search a solution using the same design given to me above. </p>
  
  <p>Can I get some suggestions on this?</p>