I want to echo out the result of a function within the initial echo.
echo "<div class='booking-item-rating'>" . stars($hotelSummary[$x]['hotelRating']) . "</div>";
The function:
function stars($stars){
for($i=1;$i<=$stars;$i++) {
echo "<i class='fa fa-star'></i>";
}
if (strpos($stars,'.')) {
echo "<i class='fa fa-star-half-empty'></i>";
$i++;
}
while ($i<=5) {
echo "<i class='fa fa-star-o'></i>";
$i++;
}
}
The problem is that the result of the function is printed outside the initial echo field, outside of the div element. How do I get the result of the function to print out within the first echo ?