Home » Php » javascript – issue with screen width condition with php

javascript – issue with screen width condition with php

Posted by: admin February 25, 2020 Leave a comment

Questions:

I want to check browser width with PHP and with that width, I want to set conditions

for that, I have used below code

<?php
$width = " <script>document.write(screen.width); </script>";
// echo $width; shows me 1600
if ($width < 767) {
echo 'less';
}else{
echo 'high';
}   
?>

and this condition shows me the result less

I don’t know why this happens

can anybody help me with this

How to&Answers: