$screen _w = "", if ($screen _w <) {echo ' width is less than 500 ';} Else{echo ' is greater than or equal to 500 ';}
Direct echo $screen _w; can get the right result is 1366
If you judge the result is 1366 less than 500
if (int) $screen _w or intval ($screen _w)
The direct display is 0.
Harry
Reply to discussion (solution)
Is it correct to say that there is no grammatical error?
1, PHP before the execution of JS! Even $screen _w = ""; To get the data, that's when the PHP code is done.
2, $screen _w = "";
What is it? It's just a string assignment.
Even with Echo $screen _w;
It's only shown in the browser.
Var_dump print out, is a 46-bit string, JS code is also counted in the inside, with the regular number matching out to compare on it.
It doesn't seem to match, and I don't know how to get the numbers out.
I've had this problem before, and the foundation is not strong.
JS and PHP to separate,
First of all to understand which is the client's code, which is the server-side code, the two server-side code is the first execution, the client is executed after
But PHP can't get the screen width ah, I want to write a sentence to determine if the screen width is less than the main content width, it does not output a floating bar that will block the content.
These questions are almost novice, ten years as (I was no exception, hehe), why all kinds of textbooks do not write this?