Trying to get Screen Size from JS in PHP working
but if else conditions same value return
Please Update Questions if you understand my questions
i want to try this code not other
$screenwidth = "<script>
    var mobilewidth = console.log(screen.width); 
    if(mobilewidth < '768'){
        document.write('Mobile');
    }else{
        document.write('Template');
    }   
</script>";
echo $screenwidth;
Output = Template or Mobile in both conditions
in PHP
function LoadTemplate() {
    $screenwidth = "<script>document.write(screen.width); </script>";
if($screenwidth<=768){
    return 'Mobile';
}else{
    return 'Template';
}    
}
Output = Template or Mobile both conditions
How to fix this please help
 
    