How can JavaScript be utilized to obtain screen resolution data and send it to a PHP server-side script?
To obtain screen resolution data using JavaScript and send it to a PHP server-side script, you can use the `screen` object in JavaScript to get the width and height of the screen. You can then send this data to a PHP script using an AJAX request or by submitting a form with the screen resolution data as a parameter.
<?php
// PHP script to receive screen resolution data
if(isset($_POST['width']) && isset($_POST['height'])){
$width = $_POST['width'];
$height = $_POST['height'];
// Do something with the screen resolution data
echo "Screen resolution received - Width: $width, Height: $height";
}
?>