So I've been working on PHP for quite some time now and I'm confident I can do pretty much anything after looking up a few commands. But one thing thats been bugging me is I think I'm outputting information to HTML incorrectly. For example.
<head>
<?php
if(stristr($_SERVER['HTTP_USER_AGENT'], "Android")){
echo "<meta http-equiv="refresh" content="0;url=http://android.website.com">";
}
?>
</head>
<body>
<?php
echo "Your user agent is " . $_SERVER['HTTP_USER_AGENT'];
?>
</body>
But I remember reading something when first starting with php that you should always put all of your php content at the top of your document or something like that. I also read somewhere that its bad to echo information like that. Someone mind showing me how you would go about doing something like this correctly?