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['...'], ...);
...
}
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
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",
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",
"
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",
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",
"
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 )
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 );
> }
>
>
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
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
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;
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] ...
}
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" =>
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" =>
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" )
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
16 matches
Mail list logo