Approach 1:
Using CSS display:none
means that the content is sent to the client but is hidden from view. In other words; the content does exist but without occupying any space.
Approach 2:
Using if(false){content}
prevents the content from being sent to the client at all.
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Approaches</title>
</head>
<body>
<div <?php if (true) {echo 'style="display:none;"';}?>>
Approach 1
</div>
<?php if (false): ?>
<div>
Approach 2
</div>
<?php endif; ?>
</body>
</html>
Which is regarded better in terms of security practices?
If both are secure, then which is regarded better in terms of performance and code design methodology?