What are alternative methods for displaying text content in a pop-up window in PHP?

One alternative method for displaying text content in a pop-up window in PHP is by using JavaScript. You can create a JavaScript function that opens a new window and displays the text content within it. This approach allows for more customization and control over the appearance and behavior of the pop-up window.

<?php
echo '<script type="text/javascript">
        function displayPopup(text) {
            var popupWindow = window.open("", "Popup", "width=400,height=200");
            popupWindow.document.write("<p>" + text + "</p>");
        }
      </script>';
      
echo '<button onclick="displayPopup(\'This is the text content in the pop-up window\')">Display Pop-up</button>';
?>