On Sun, 2005-10-30 at 15:57, Ron Korving wrote:
> The function I used in my post does not generate an E_NOTICE, because a
> call-by-reference can be done with an unset variable (that can be set from
> the function).
>
>error_reporting(E_ALL);
>
> function ifsetor(&$var, $value)
> {
>
The function I used in my post does not generate an E_NOTICE, because a
call-by-reference can be done with an unset variable (that can be set from
the function).
This simply prints 'test' and shows no errors. In fact, a var_dump() on $bla
will show that it's become NULL. Never mind this whole if
On Sat, 29 Oct 2005, Sara Golemon wrote:
How about ||| and |||= ?
How about a good ol' beating with a large trout? :)
--Jani
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
On Sun, 2005-10-30 at 09:52 +0100, Ron Korving wrote:
> I'm a big fan of coalesce($param1, $param2, ..., $paramN) (or firstset()).
> The syntax allows for more than what ifsetor($var, $value) would do.
> Ifsetor() could be done in userspace, but I don't see how coalesce() could,
> because of the va
Hi Marcus,
> ifsetor or any equivalent cannot be done in userspace.
i agree here.
Last time this topic has been discussed I've naively asked for
opinions regarding a userland implementation. Afterwards the
discussion suddenly ended.
In the meantime I've tried to use it more often but found myse
function ifsetor(&$var, $value)
{
return (isset($var)) ? $var : $value;
}
can be done in userspace.
Perhaps, but it won't do what you think, and certainly won't do what this
thread has been discussing for over half a year.
--
PHP Internals - PHP Runtime Development Mailing List
To unsu
Marcus, my point was that this simple function:
function ifsetor(&$var, $value)
{
return (isset($var)) ? $var : $value;
}
can be done in userspace, and that a coalesce() like function will have the
added benefit of a variable number of parameters, which as far as I know,
cannot be done
I'm a big fan of coalesce($param1, $param2, ..., $paramN) (or firstset()).
The syntax allows for more than what ifsetor($var, $value) would do.
Ifsetor() could be done in userspace, but I don't see how coalesce() could,
because of the variable number of parameters.
Ron
"Sean Coates" <[EMAIL PROT
Hello Ron,
damn it! ifsetor or any equivalent cannot be done in userspace. If you
don't get don't write here.
marcus
Sunday, October 30, 2005, 9:52:47 AM, you wrote:
> I'm a big fan of coalesce($param1, $param2, ..., $paramN) (or firstset()).
> The syntax allows for more than what ifsetor($va
Whatever the name is, I think the most important thing should be that
second argument is not evaluated if the first one is set.
And about the name - $a = $b ?? $c looks good. $a ??= $c is fine too
because it is close to $a = $b || $c and $a ||= $c..
On 30/10/05, Ron Korving <[EMAIL PROTECTED]> wro
10 matches
Mail list logo