PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to get this perfect for my web page but i'm stuck in a repetitive circle. The problem is it displays a "1" on the index.php page after the included home.php .. I tried not putting the else include into a var and it fixed it but why is it doing it when its like this.
include() is basically the same as pasting the contents of the file into the script at that point. When you do "$contents = include('page_includes/page'.$page.'.php');" it's the include() call that's 'echo'ing the contents of the file. $contents is actually set to the return value of include() ... 1 if it worked, 0 if it didn't. So you're printing the contents of the file followed by the return value. Consequently you get a 1 at the end.
Thank you .. i just do a straight include instead of putting it into a variable, if I really had the need to do so is there another method for accomplishing this without the return value being printed.
blair_24986 wrote:Thank you .. i just do a straight include instead of putting it into a variable, if I really had the need to do so is there another method for accomplishing this without the return value being printed.