How can PHP be integrated with JavaScript to achieve specific functionalities like opening a pop-up window?

To achieve functionalities like opening a pop-up window using PHP and JavaScript, you can use PHP to generate the JavaScript code that will handle the pop-up window. You can echo out the JavaScript code within your PHP script to trigger the pop-up window when certain conditions are met.

<?php
// PHP code to generate JavaScript for opening a pop-up window
echo '<script type="text/javascript">
    function openPopup() {
        window.open("popup.html", "Popup", "width=400,height=400");
    }
</script>';
?>