I am trying to make a hangman game where a 'for' loop scrolls through different images but I can't get the previous image to be replaced by the next one, this was originally meant to be drawn through vectors but I went another way, any suggestions, below is the code:
<?php
$dude = [
'<img id="hung"src="images/hangman00.png"/>',
'<img id="hung"src="images/hangman01.png"/>',
'<img id="hung"src="images/hangman02.png"/>',
'<img id="hung"src="images/hangman03.png"/>',
'<img id="hung"src="images/hangman04.png"/>',
'<img id="hung"src="images/hangman05.png"/>',
];
function drawdude(){
global $dude;
for ($i=0; $i <= $_SESSION['numwrong']; $i++) {
echo $dude[$i];
}
echo '</img>';
}
?>