Jump to content

strange function problem


aleX_hill

Recommended Posts

OK, this is a strange one I am hoping someone can help with.

 

I have a file with a heap of functions which work fine. This file is included in my other files, and the function to display the content is called. For example I include the master file in guestbook.php, which calls showGuestbook(). Same with contact.php, it calles showContact(); etc.

 

The file is outside the web root of the website calling it.

 

So I went to add another function called downloadFile(). When I try to call the function, it gives me the "call to undefined function" error. I have tried renaming it to a few diff things, same error. So I thought there could be a brace error somewehere in the file. This is the strange bit.... When I put that function at the top of the file, the page seems to fail to parse. None of the functions are available...

 

The function so far is simply:

function downloadFile()
{
echo "Download File";
}

 

Can anyone shed some light on this strange behaviour, especially the errors that occur just because I move the code higher up the file.

Link to comment
https://forums.phpfreaks.com/topic/217083-strange-function-problem/
Share on other sites

True puzzle..especially from here since we can't see any of your code.

 

Sometimes when apparently stupid things like this keep happening, I take drastic measures.

 

Put the code at the top, make sure it works on it's own within this file first. Then, begin to add your previous functions to the file one by one, and maybe just one will trigger the error. Now you have pinpointed the source.

 

I really can't think of *any* reason why this would cause a parse issue unless the function is within another function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.