选项卡/缩进在Windows服务器上阻止代码

I have the following code and it's working great on my local xampp and test linux webhosting:

<?php
// include config file
include('config.php');

// get page intel
$_PAGE = switchPage($_GET);

// require language file
require_once("languages/".$_PAGE['language'].".lang.php");

// include header file
include('includes/header.inc.php');
?>

            <section id="main" class="clearfix">

                <?php
                // include correct page
                include($_PAGE['include_path']);
                ?>

            </section>

<?php
// include footer file
include('includes/footer.inc.php');
?>

My client has a windows server with PHP 5.2.6 installed. The hosting company claims that tabs/indents like used in the following snipet out of the code does not work on a windows php hosting.

            <?php
            // include correct page
            include($_PAGE['include_path']);
            ?>

So they claim my code is not valid PHP code.. Can someone advice please? I don't want to rewrite my code just because of all the indents I use to keep my code clean and readable ..

It makes no difference if you use tabs or spaces. That's still valid php.

So they claim my code is not valid PHP code.. Can someone advice please?

On one hand, they're full of it. It's valid code.

On the other hand, that code could be problematic -- if that was the opening <?php tag at the beginning of a file. This is the #2 cause of the infamous "cannot send headers, headers already sent" error that PHP can generate. Each PHP file should not have any whitespace before the opening PHP tag.

That tag is in the middle of the document and thus is not a problem.

Maybe what is happening is that you are ending each line with line feed character (that's what linux uses) instead of a carriage return + line feed (windows).

If the new line characters are ignored then all the code in a file will end up on one line, causing all kinds of problems (e.g. a comment like '// hello' halfway down a page will end up commenting out all the code that follows).

Try converting the file to windows format (CR+LF). You can do it with a good text editor like Notepad++.

And like others have said, how you indent your code doesn't matter.