So I got 4 php variables, and I have 1 javascript variable with the name of one of those 4 php variables, how can I call it.
$p1 = ...
$p2 = ...
$p3 = ...
$p4 = ...
<script>
var myoption = 'p1';
var myarray = <?= $p1 ?>;
console.log(myarray);
</script>
In this case instead of setting myarray to $p1, I want to do it with myoption, once myoption can be p2 or p3