'Can i set a php variable value to a html element that is being manipulated by javascript

Im sorry I didnt know how to phrase my question well, but i have my php code:

<div class="header">
        <h1>Space Invaders</h1>
        <p style="color: yellow;">.</p>
    </div>
    <h1 class="results">SCORE: 0</h1>
    <?php
    $results = "results";
    if ($results == 'YOU WIN') {
        echo("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");
    }
    ?> 

and i have my script that will change the text at class results when the game finishes it will say "YOU WIN" Okay so now i want to make a if statment in php when the results transforms into "YOU WIN". I just cant figure a way out, sorry about my english too.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source