elepil
asked on
Question about include/include_once
If a PHP page has two consecutive include statements like:
include File1.php
include File1.php
Will the code in File1.php get included twice? Because if it does, and File1.php contains functions, the result will be duplication of functions within the same PHP document.
But if it does not get included twice, wouldn't include_once become redundant?
include File1.php
include File1.php
Will the code in File1.php get included twice? Because if it does, and File1.php contains functions, the result will be duplication of functions within the same PHP document.
But if it does not get included twice, wouldn't include_once become redundant?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@elepil: distribute points any way you want -- they're your virtual currency, after all, and I already have enough points to orbit Saturn.
Here is how I answer questions that scream out "I have never read the manuals!..."
I post links to the PHP man pages! They are, after all, required reading for anyone who wants to write PHP scripts. And there is a lot of good information in the PHP man pages.
Here is how I answer questions that scream out "I have never read the manuals!..."
I post links to the PHP man pages! They are, after all, required reading for anyone who wants to write PHP scripts. And there is a lot of good information in the PHP man pages.
explanations of the way the function works
its expected arguments
its possible return values
examples of usage
user-contributed notes
Taken together these things make PHP.net one of the most valuable resources a programmer can have. So I try to encourage its use. It's not that I'm lazy about answering questions, but some of the questions come up over and over again. When I see that sort of thing in a larger context, I write an article about it. But when the question is "how do I use a function" there is no better place to learn than from the authors of PHP.
ASKER
Ray Paseur,
It's interesting that you quickly judged me as "lazy". Having posted many questions on this forum, I've encountered far too many responders who were "lazy" to give me a direct answer and just blindly copied and pasted text they found in Google. It really goes both ways.
But when all has been said and done, the key criterion is whether a question asked has been thoroughly answered or not. In this case, Marco Gasi was the only one who did just that, and in a very concise and direct fashion I might add. Responders should learn from him.
Your post provided a link to the PHP manual about "include". The page was lengthy and exhaustive in discussing "include", but nowhere does it say the error message that I would've gotten as Marco Gasi pointed out. So to follow your method, I would've spent an inordinate amount of time reading without really getting a direct answer to my question. Don't get me wrong, I'm not saying one should not read the manual, as everyone eventually should. But don't miss the forest for the trees -- that when one has a question, one seeks a direct and concise answer.
If you ask me for directions on a destination, do you want me to refer you to a map instead? Or would you appreciate it more if I gave you exact directions?
I still appreciate you responding, and I respect the method you are suggesting. But I hope you will be flexible enough to realize that there are more ways than one to arrive at a destination, and have the wisdom to respect how others approach their problems without being judgmental.
It's interesting that you quickly judged me as "lazy". Having posted many questions on this forum, I've encountered far too many responders who were "lazy" to give me a direct answer and just blindly copied and pasted text they found in Google. It really goes both ways.
But when all has been said and done, the key criterion is whether a question asked has been thoroughly answered or not. In this case, Marco Gasi was the only one who did just that, and in a very concise and direct fashion I might add. Responders should learn from him.
Your post provided a link to the PHP manual about "include". The page was lengthy and exhaustive in discussing "include", but nowhere does it say the error message that I would've gotten as Marco Gasi pointed out. So to follow your method, I would've spent an inordinate amount of time reading without really getting a direct answer to my question. Don't get me wrong, I'm not saying one should not read the manual, as everyone eventually should. But don't miss the forest for the trees -- that when one has a question, one seeks a direct and concise answer.
If you ask me for directions on a destination, do you want me to refer you to a map instead? Or would you appreciate it more if I gave you exact directions?
I still appreciate you responding, and I respect the method you are suggesting. But I hope you will be flexible enough to realize that there are more ways than one to arrive at a destination, and have the wisdom to respect how others approach their problems without being judgmental.
So you are lazy reading and I am lazy writing. Fair enough :)
ASKER
Surrano,
Actually I am not lazy reading in this case. I was just trying to find the shortest route from A to B.
As I mentioned to Ray Paseur, the link he provided about "include" was lengthy and did not directly address my problem. I would've spent so much time reading and end up empty-handed. If you examine Marco Gasi's response, you wouldn't find that in the link you or Ray Paseur provided.
I'm not saying I never consult the manual or do google searches, but in this case, I felt it easier to consult the more experienced on how "include" behaves. Nor am I saying I am never lazy, but in this case, I wasn't; I was merely trying to be more efficient in my pursuit of an answer.
I'm not sure why I'm even having this discussion on a board like this. This forum has a question and answer format. The more direct the answers, the more efficacious this forum would be. You and Ray Paseur did provide answers, but they were more of redirections than a direct answer to my problem. Now I don't know if you are like Ray who has "enough points to orbit Saturn", but if that were the case, what motivation would you have left to respond to other people? Is it not your desire to serve and help the community? And if so, wouldn't giving a very specific and direct answer serve your end better?
Actually I am not lazy reading in this case. I was just trying to find the shortest route from A to B.
As I mentioned to Ray Paseur, the link he provided about "include" was lengthy and did not directly address my problem. I would've spent so much time reading and end up empty-handed. If you examine Marco Gasi's response, you wouldn't find that in the link you or Ray Paseur provided.
I'm not saying I never consult the manual or do google searches, but in this case, I felt it easier to consult the more experienced on how "include" behaves. Nor am I saying I am never lazy, but in this case, I wasn't; I was merely trying to be more efficient in my pursuit of an answer.
I'm not sure why I'm even having this discussion on a board like this. This forum has a question and answer format. The more direct the answers, the more efficacious this forum would be. You and Ray Paseur did provide answers, but they were more of redirections than a direct answer to my problem. Now I don't know if you are like Ray who has "enough points to orbit Saturn", but if that were the case, what motivation would you have left to respond to other people? Is it not your desire to serve and help the community? And if so, wouldn't giving a very specific and direct answer serve your end better?
ASKER
When I ask a question here in Experts Exchange, it's because I want a QUICK and DIRECT answer. I give more points for such. Links referrals may or may not get points, depending on how helpful they are.
Thanks all for responding.