You need some JS to achieve this by simply adding alert('Your message')
within your PHP code.
See example below
<?php
//my other php code here
function function_alert() {
// Display the alert box; note the Js tags within echo, it performs the magic
echo "<script>alert('Your message Here');</script>";
}
?>
when you visit your browser using the route supposed to triger your function_alert
, you will see the alert box with your message displayed on your screen.
Read more at https://www.geeksforgeeks.org/how-to-pop-an-alert-message-box-using-php/