Bogle Bogle - 2 months ago 8
PHP Question

how to use php to display chr() in html

i would like to use the chr function to display abc++ in code block but i do not know how to incorporate the chr function in this block of html code.

php

<?php
for ($x = 65 ; $x <= 90; $x ++){
echo "<div class='black-box'>
<div class='letter'>
chr($x); <sub class='small'>$x</sub>
</div>
</div>" ;} ?>

Answer

You must concatenate the PHP function to make it work, so this is my code

<?php
for ($x = 65 ; $x <= 90; $x++) {
    echo "<div class='black-box'>
          <div class='letter'>";
    echo chr($x);
    echo "<sub class='small'>$x</sub>
          </div>
          </div>";
}
?>
Comments