SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: invisible code?

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    invisible code?

    I'll just give an example.

    PHP Code:
    // some php class file
    class foo extends bar
    {
        public function 
    foo()
        {
                echo 
    'i';
                
    parent::_construct();
         }
    }

    // another php file
    include 'some php class file';

    $foo = new foo(); 
    i is being output after a \n\t. What else can possibly be executed before echo 'i'?
    I checked the parent constructors and they are being executed after like they should. My server isn't just outputting a \n\t at the start of every document either.

    Is there anything else that could be executed before echo 'i'?

  2. #2
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does the PHP block start on the first line, without any whitespace before it.

    e.g. This would output whitespace before the PHP output
    PHP Code:
    ** whitespace here ** (forum won't let me demonstrate)
    <?php
    echo "Hello world";
    ?>

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you mean that you want to have the output in HTML page to be formated with \t for tabs and \n for new line? I don't think that you can have like this formating with \t \n.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Whats the full code of both files?

    perhaps you have a newline and a tab before <?php
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #5
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't see any white space before anything being included. I have a feeling that might be the problem. but I've checked everything and I'm certain there isn't any. And when I put echo '1' before the $foo = new foo(); it puts it in the right place. That is the thing that I just can't figure out.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •