1

I have find the way to print current window size with using js and php but when i execute with function it won't works. Any one please help.

<?php $currentwidth = " <script>document.write(window.innerWidth); </script>";
echo $currentwidth; //works fine but belowis not working
if ( $currentwidth <= "480" ) { echo "TRUE"; } else { echo "FALSE"; }; ?>

Raha MK
  • 102
  • 1
  • 13

1 Answers1

1

You are mixing up javascript and php. javascript runs in browser and php runs in server. If you want php to print something you have to send the value to the server.

Neel Ion
  • 1,547
  • 1
  • 10
  • 14