Re: [PHP] Question on functions

2004-11-11 Thread Jason
That is exactly the type of example I was in need of. Thanks a ton. Elixon wrote: I'm not certified expert ;-) but what I meant is Do not use function that writes to the hardcoded global variables: example: function db() { ... $GLOBALS['db']=x_open_something($GLOBALS['...'], ...); ... }

Re: [PHP] Question on functions

2004-11-11 Thread elixon
I'm not certified expert ;-) but what I meant is Do not use function that writes to the hardcoded global variables: example: function db() { ... $GLOBALS['db']=x_open_something($GLOBALS['...'], ...); ... } This function is really... hm... not flexible enough ;-) It can make

Re: [PHP] Question on functions

2004-11-11 Thread Jason
Sebastian Mendel wrote: Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user",

Re: [PHP] Question on functions

2004-11-11 Thread Sebastian Mendel
Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "

Re: [PHP] Question on functions

2004-11-11 Thread Jason
Sorry, yeah it is a typo Sebastian Mendel wrote: Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost",

Re: [PHP] Question on functions

2004-11-11 Thread Sebastian Mendel
Jason wrote: Looks like you understand already. Did you have some broken code you wanted help with? yeah.. I should have posted it first. Here it is: /* User Defined Variables */ $defined = array( "0" => "localhost", "1" => "user", "

Re: [PHP] Question on functions

2004-11-10 Thread Jason
Greg Donald wrote: On Wed, 10 Nov 2004 10:10:37 -0700, Jason <[EMAIL PROTECTED]> wrote: Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db )

Re: [PHP] Question on functions

2004-11-10 Thread Greg Donald
On Wed, 10 Nov 2004 10:10:37 -0700, Jason <[EMAIL PROTECTED]> wrote: > Yeah the global stuff I understand and can use fine. What I would like > more information about is the use of arguments to functions i.e. > function( $user, $pass, $db ) { > $db = @mysql_connect( $user, $pass, $db ); > } > >

Re: [PHP] Question on functions

2004-11-10 Thread Jason
Yeah the global stuff I understand and can use fine. What I would like more information about is the use of arguments to functions i.e. function( $user, $pass, $db ) { $db = @mysql_connect( $user, $pass, $db ); } I understand parts but googling for the proper use of functions in php hasn't got

Re: [PHP] Question on functions

2004-11-10 Thread Sebastian Mendel
Jason wrote: Could you give me a good example of the tip you recommend or point me to a good tutorial on it? $GLOBALS holds all variables defined in main(), main() meaning outside any function or class //main() $my_var = 'test'; function myFunction() { echo $GLOBALS['my_var']; // is the

Re: [PHP] Question on functions

2004-11-10 Thread Jason
Could you give me a good example of the tip you recommend or point me to a good tutorial on it? Elixon wrote: Or you can use superglobal variable $GLOBALS that is array containing all GLOBAL variables. This variable is superglobal thus does not need to be declared global using 'global $GLOBALS;

Re: [PHP] Question on functions

2004-11-10 Thread elixon
Or you can use superglobal variable $GLOBALS that is array containing all GLOBAL variables. This variable is superglobal thus does not need to be declared global using 'global $GLOBALS;' statement. Works anywhere. function database() { ... $GLOBALS['array'][0], $GLOBALS['array'][1] ... }

Re: [PHP] Question on functions

2004-11-10 Thread Jason Gerfen
John Holmes wrote: Jason wrote: My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( "0" => "hostname", "1" =>

Re: [PHP] Question on functions

2004-11-10 Thread John Holmes
Jason wrote: My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( "0" => "hostname", "1" => "username", "2" =>

[PHP] Question on functions

2004-11-10 Thread Jason
My question is in regard to passing global variables to a function. Here is my code, any idea why it is not working? I suppose my understanding of a global variable being able to be used within a function is off? global $array = array( "0" => "hostname", "1" => "username", "2" => "password" )

[PHP] Question on functions finding out about caller

2002-03-13 Thread scott furt
I've checked google and the PHP manual, with no results, so i thought i'd ask here: Is there any functionality in PHP to allow a function to find out what function/file/line called it? AFAIK, perl can do this, and i've always found it a big help when debugging to have functions die with a call t