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.
The ampersand before the function name indicates that the function returns a
reference instead of a copy of the variable, for example:
?php
function max($var1, $var2) {
if ($var1 $var2) return $var1;
else return $var2;
}
$global1 = 10;
$global2 = 9;
$maxglobal = max($global1,
On Tue, April 11, 2006 10:42 am, tedd wrote:
?php
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?
The ampersand before the function name indicates that the function
returns a reference instead of a copy of the variable, for example:
?php
function max($var1, $var2) {
if ($var1 $var2) return $var1;
else return $var2;
}
$global1 = 10;
$global2 = 9;
$maxglobal =
tedd wrote:
The ampersand before the function name indicates that the function
returns a reference instead of a copy of the variable, for example:
?php
function max($var1, $var2) {
if ($var1 $var2) return $var1;
else return $var2;
}
$global1 = 10;
$global2 = 9;
$maxglobal =
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
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,
It's the same thing for the most part...
?php
$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
shovels to dig yourself in as deep as you want.
Thanks Rob.
tedd
--
On Mon, 2006-04-10 at 09:42, tedd wrote:
It's the same thing for the most part...
?php
$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
shovels to dig
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
?php
function foo { echo Hi;}
$bar = 'foo';
$bar();
?
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
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) ).
In
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
--
Ray Hauge
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
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 using the
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 not
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 (php4
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
18 matches
Mail list logo