Code Snippet </> Info
Snippet Name: JavaScript to PHP Variable
Description: Convert JavaScript variable to PHP variable.
Note: An example of how to convert a javascript variable to a php variable.
Author: Snap Builder <snippets@snapbuilder.com>
Last Modified: 2019-12-15 02:48:46
Language: php
Highlight Mode: html
|
Copy Codes: Use Free Notepad ++ |
|
Snap HTML Code Editor: Paste the source code, make changes and instantly see it in live preview. Snap HTML Code Editor
|
|
Copied To Clipboard!
<?php
/*
after this simple script content of PHP variable $s_wid will be
JavaScript variable s_wid - which is screen.width
This script found at: https://sanpbuilder.com Free Public Codes Library
*/
ob_start("stat");
?>
<script language="javascript">
var s_wid = 0
s_wid = screen.width
document.write(s_wid);
</script>
<?php
$s_wid = ob_get_contents();
ob_end_flush();
?>
|