DragonPrime - LoGD Resource Community

Game Administration, Installation and Configuration => Game Administration Chat => Topic started by: Dhampir on October 06, 2005, 04:00:46 PM



Title: functions
Post by: Dhampir on October 06, 2005, 04:00:46 PM
Hello,

I was just coding earlier, and I thought of something..

Where exactly are things like, httpget();, addnav(); blocknav();, and things of that nature defined?

I can recall a time when i've come over them.


Title: Re:functions
Post by: Sichae on October 06, 2005, 05:10:01 PM
httpget -> lib/http.php

addnav, blocknav -> lib/output.php

They are already called in runmodule.php, so Modules do not need to require them. It would just be redundant.


Title: Re:functions
Post by: Kendaer on October 07, 2005, 11:04:23 AM
requiring them is redundant, but assuming you use require_once, imposed no additional load on the server if they are already included.

It's also not always obvious which ones are or aren't already included.

The best rule of thumb is, include it if you aren't sure that it's already there in all cases. :)


Title: Re:functions
Post by: XChrisX on October 07, 2005, 11:28:36 AM
requiring them is redundant, but assuming you use require_once, imposed no additional load on the server if they are already included.
No significant load...

The linker has to jump around a little more... testing if this already has been required or not... ;)


Title: Re:functions
Post by: Kendaer on October 09, 2005, 04:50:03 PM
No significant load...

The linker has to jump around a little more... testing if this already has been required or not... ;)

Actually, it doesn't.  PHP keeps a hash of all included files.. So the 'cost' of this, is a simple lookup in a hash table.  this is *VERY FAST* to the point where I would call it no load.


Title: Re:functions
Post by: XChrisX on October 09, 2005, 11:27:03 PM
Every picosecond counts!!! *waaah*

You are right... I use require_once too, because it's simply better than "require"... But in some cases "require()" is needed

If you include a file with a variable
Code:
require_once("$filename.php");
And if you come across that call again during runtime with a different $filename... But that's not the problem here... ;)

© 2018 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines