I want to reverse the order of the table but don't know how to put php in the function. Here's what I have:

<html>
<head>
<script>

function reverse()
{
/* HOW DO I GET PHP IN HERE? */
}

</script>


</head>

<body>
<?php
$w="A";
$x="B";
$y="C";
$z="D";
?>

<table style="border:1px solid black;">
<tr>
<td><?php echo "$w";?></td>
</tr>
<tr>
<td><?php echo "$x";?></td>
</tr>
<tr>
<td><?php echo "$y";?></td>
</tr>
<tr>
<td><?php echo "$z";?></td>
</tr>
</table>


<button onclick="reverse()">Reverse Order</button>

</body>
</html>