I’m working on my assignment of PHP course.
The problem that I don’t understand is that I’m keep getting extra lines when I actually use the function to all the parts.
Like on my index.php page
<?php include('library.php') ?>
<?php top_header(); ?>
And here is my function top_header codes from library.php
<?php function top_header(){ ?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head><title></title></head>
<body>
<?php } ?>
So when I use the validation the check my codes it says that the xml doctype has to be on the 1st line and when I check my source code I see that is not on the first line. I have remove and recreate the page two times now (first it was on the 4th line now it is 2nd line)

There is a line break between the first two lines:
And this line break actually generates the first empty line!
Use the following:
and everything works fine 🙂