Re: [PHP] function by reference

2006-04-11 Thread Robert Cummings
On Tue, 2006-04-11 at 23:15, Martin Alterisio "El Hombre Gris" wrote: > Well, it was a bad example to begin with, first of all max() is already > defined in php, I should at least checked that before posting. Second, I > forgot PHP (the Zend engine) has an interesting way of handling > variables

Re: [PHP] function by reference

2006-04-11 Thread Martin Alterisio \"El Hombre Gris\"
Well, it was a bad example to begin with, first of all max() is already defined in php, I should at least checked that before posting. Second, I forgot PHP (the Zend engine) has an interesting way of handling variables, when you copy assign a var or pass it as an argument of a function, a real

Re: [PHP] function by reference

2006-04-11 Thread Chris
tedd wrote: The ampersand before the function name indicates that the function returns a reference instead of a copy of the variable, for example: $var2) return $var1; else return $var2; } $global1 = 10; $global2 = 9; $maxglobal =& max($global1, $global2); $maxglobal++; echo $

Re: [PHP] function by reference

2006-04-11 Thread tedd
The ampersand before the function name indicates that the function returns a reference instead of a copy of the variable, for example: $var2) return $var1; else return $var2; } $global1 = 10; $global2 = 9; $maxglobal =& max($global1, $global2); $maxglobal++; echo $global1; //

Re: [PHP] function by reference

2006-04-11 Thread Richard Lynch
On Tue, April 11, 2006 10:42 am, tedd wrote: >function &ref3($a) > { > $a--; > } > > ?> I believe this one will only "matter" if you are RETURNING a value. And only really matter if that value is an object... -- Like Music? http://l-i-e.com/arti

Re: [PHP] function by reference

2006-04-11 Thread Martin Alterisio
The ampersand before the function name indicates that the function returns a reference instead of a copy of the variable, for example: $var2) return $var1; else return $var2; } $global1 = 10; $global2 = 9; $maxglobal =& max($global1, $global2); $maxglobal++; echo $global1; //th

Re: [PHP] function by reference

2006-04-11 Thread tedd
At 7:31 PM -0700 4/10/06, Ray Hauge wrote: > I believe you're thinking more of the C++ style of returning by reference. This article should help explain how references work, and how to return references... most specifically check the "Returning References" section. > http://www.php.net/ma

Re: [PHP] function by reference

2006-04-10 Thread Ray Hauge
> > I believe you're thinking more of the C++ style of returning by reference. > This article should help explain how references work, and how to return > references... most specifically check the "Returning References" section. > > http://www.php.net/manual/en/language.references.php > > HTH > --

Re: [PHP] function by reference

2006-04-10 Thread Ray Hauge
On Monday 10 April 2006 19:19, Richard Lynch wrote: > On Sun, April 9, 2006 1:17 pm, tedd wrote: > > Hi gang: > > > > Not that I have an immediate need for this, but in other languages > > one can access a function by reference (in other words, it's address > > -- such as call(function address) ).

Re: [PHP] function by reference

2006-04-10 Thread Richard Lynch
On Sun, April 9, 2006 1:17 pm, tedd wrote: > Hi gang: > > Not that I have an immediate need for this, but in other languages > one can access a function by reference (in other words, it's address > -- such as call(function address) ). > > In php, one can pass a variable by reference by simply usi

Re: [PHP] function by reference

2006-04-10 Thread tedd
> Boy, am I in love with this language -- it gives you plenty of shovels to dig yourself in as deep as you want. *lol*. personally I prefer the other format which was what I tried to illustrate with my original example: Oh, you illustrated it very well. I looked intently at it and learned

Re: [PHP] function by reference

2006-04-10 Thread Robert Cummings
On Mon, 2006-04-10 at 09:42, tedd wrote: > >It's the same thing for the most part... > > > > > > >$a = 'f_a'; > >call_user_func( $a, $p1, $p2, $p3 ) > > > >?> > > > >Cheers, > >Rob. > > Rob: > > No way dude -- that was too easy! > > Boy, am I in love with this language -- it gives you plenty of

Re: [PHP] function by reference

2006-04-10 Thread tedd
It's the same thing for the most part... Cheers, Rob. Rob: No way dude -- that was too easy! Boy, am I in love with this language -- it gives you plenty of shovels to dig yourself in as deep as you want. Thanks Rob. tedd -- ---

Re: [PHP] function by reference

2006-04-09 Thread Robert Cummings
On Sun, 2006-04-09 at 14:17, tedd wrote: > Hi gang: > > Not that I have an immediate need for this, but in other languages > one can access a function by reference (in other words, it's address > -- such as call(function address) ). > > In php, one can pass a variable by reference by simply usi

[PHP] function by reference

2006-04-09 Thread tedd
Hi gang: Not that I have an immediate need for this, but in other languages one can access a function by reference (in other words, it's address -- such as call(function address) ). In php, one can pass a variable by reference by simply using the ampersand, such a &$a. Is there a similar w

[PHP] Function by reference

2001-01-31 Thread Niklas Saers
Hi all. I was wondering, can a reference be a function as well? Reason is, I've got to do a little manipulating. I want to do a $tmpParsing=eregi_replace("href=(\")([^*]*)(\")","href=\"\\1\"",$this->dataToBeParsed); where I want \\1 to be fed into urlencode() I was thinking somewhere along th

Re: [PHP] Function by reference?

2001-01-31 Thread Wico de Leeuw
At 11:35 31-1-01 +0300, Max A. Derkachev wrote: >Hello Niklas, > >Wednesday, January 31, 2001, 7:02:49 PM, you wrote: >NS> >$tmpParsing=eregi_replace("href=(\")([^*]*)(\")","href=\"\\1\"",$this->dataToBeParsed); Take a look @ Preg_Replace with the e modifier, i think you are looking for that (p

Re: [PHP] Function by reference?

2001-01-31 Thread Max A. Derkachev
Hello Niklas, Wednesday, January 31, 2001, 7:02:49 PM, you wrote: NS> $tmpParsing=eregi_replace("href=(\")([^*]*)(\")","href=\"\\1\"",$this->dataToBeParsed); NS> where I want \\1 to be fed into urlencode() I was thinking somewhere along the lines NS> $func=&urlencode; It won't work. You can

[PHP] Function by reference?

2001-01-30 Thread Niklas Saers
Hi all. I was wondering, can a reference be a function as well? Reason is, I've got to do a little manipulating. I want to do a $tmpParsing=eregi_replace("href=(\")([^*]*)(\")","href=\"\\1\"",$this->dataToBeParsed); where I want \\1 to be fed into urlencode() I was thinking somewhere along th