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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.