Bogle Bogle - 1 year ago 53
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.


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

Answer Source

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

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