What are the advantages and disadvantages of using iframes in PHP to display external content?

When using iframes in PHP to display external content, the main advantage is that it allows you to embed content from other websites seamlessly into your own site. However, the main disadvantage is that iframes can sometimes cause security vulnerabilities, such as clickjacking or cross-site scripting attacks. It is important to carefully consider the risks and implement proper security measures when using iframes.

<?php
// Example of using an iframe to display external content
$external_url = "https://www.example.com";
?>
<!DOCTYPE html>
<html>
<head>
    <title>Display External Content</title>
</head>
<body>
    <iframe src="<?php echo $external_url; ?>" width="100%" height="500px"></iframe>
</body>
</html>