Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP include printing unexpectedly

Tags:

html

php

I'm trying to use a PHP include or require like this:

        <div id="menu">
          <?php 
            include("tmpl/links.php");
          ?>
        </div>

And it's including the links, but it's also printing some garbage. It's printing this above the menu:

        

This doesn't mean anything at all to me. It's happening if I use include or require. Here's links.php, for good measure:

      <ul>
        <li>
          <a href="index.php">Home</a>
        </li>
        <li>
          <a href="schedule.php">Schedule/Results</a>
        </li>
        <li>
          <a href="roster.php">Roster</a>
        </li>
        <li>
          <a href="coaches.php">Coaching Staff</a>
        </li>
        <li>
          <a href="aboutus.php">About Us</a>
        </li>
        <li>
          <a href="prospective.php">Prospective Players</a>
        </li>
        <li>
          <a href="links.php">Links</a>
        </li>
        <li>
          <a href="photos.php">Photos</a>
        </li>
        <li>
          <a href="contactUs.php">Contact Us</a>
        </li>
        <li>
          <a href="https://www.facebook.com">Facebook</a>
        </li>
      </ul>

Can anyone help me figure out how to eliminate the garbage ()?

like image 253
piebie Avatar asked Jan 29 '26 06:01

piebie


1 Answers

It's the UTF-16 BOM (Byte order mark).

Solution: Never use UTF-16.

Save the file as UTF-8 instead.

like image 184
Ariel Avatar answered Jan 30 '26 22:01

Ariel