Marcus,
This doesn't mean we're going to create opcodes for every new feature nor
does it mean that people should stop using functions. In any case, the
performance impact is probably close to negligible as getting the variables
is often only a small part of the script. DB access for example, i
quot; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, April 17, 2004 10:20 AM
Subject: Re: [PHP-DEV] Re: [RFC] ifsetor operator
> if you make @ fetch_var it's own opcode,
>
> - on isset() = true you do a straight return value. .. No touching
> erro
if you make @ fetch_var it's own opcode,
- on isset() = true you do a straight return value. .. No touching
error handler etc.. (this should be v.fast)
- on isset() = false you modify the error_handling + do the callback
(this is slow...)
You have effectively solved the performance issue 99%
Don't forget that some users make use of set_error_handler(). This results
in a user function being called with quite a bit of parameter data EVEN if
an @ is prepended to the statement. The error level is temporarily set to
0 for the duration of the statement.
That's why a new internal functi
Yeah looks like 50% slower..!
Wouldnt it make more sense to optimize @ + fetch_var(), rather than
introduce new syntax?
Regards
Alan
Marcus Boerger wrote:
Hello Alan,
Saturday, April 17, 2004, 2:36:55 AM, you wrote:
Jason Garber wrote:
In our code, you will find many blocks looking like
$C
Hello Red,
a user function call is much much more expensive.
marcus
Saturday, April 17, 2004, 4:33:56 AM, you wrote:
> I guess this would only help the lazy guys around. There are many other
> ways to get around this without writing that many ternary constructs
> eg:
> function get_post_var
I guess this would only help the lazy guys around. There are many other
ways to get around this without writing that many ternary constructs
eg:
function get_post_var ( $name , $default ) {
return isset ( $_POST[ $name ] ) ? $_POST[ $name ] : $default ;
}
$CUST_ID = (integer) get_post_var (
Yeah,
When we first switched to E_ALL error mode, I thought "Cool, I'll just put
an @ in front of these expressions"
Not cool. It was taking FOREVER (like seconds) to load a simple page that
had been taking ~ 20ms. After that we switched to the ternary operator,
and hence began the ifsetor()
Hello Alan,
Saturday, April 17, 2004, 2:36:55 AM, you wrote:
> Jason Garber wrote:
>> In our code, you will find many blocks looking like
>>
>> $CUST_ID = (integer) (isset($_POST['CUST_ID']) ? $_POST['CUST_ID'] : 0);
> so how is that different from
> $CUST_ID = (integer) @$_POST['CUST_ID'];
@
Jason Garber wrote:
In our code, you will find many blocks looking like
$CUST_ID = (integer) (isset($_POST['CUST_ID']) ? $_POST['CUST_ID'] : 0);
so how is that different from
$CUST_ID = (integer) @$_POST['CUST_ID'];
other than being pig headed about @... :)
Regards
Alan
--
PHP Internals - PHP Ru
efactor, you need to change your construct
back to if{}else{} often introducing bugs. I see no reason to save ~ 10
keystrokes at the cost of readability.
-Sterling
-Original Message-
From: Marcus Boerger [mailto:[EMAIL PROTECTED]
Sent: Friday, April 16, 2004 3:29 PM
To: Andi Gutmans
Cc: [EMAIL P
see no reason to save ~ 10
keystrokes at the cost of readability.
-Sterling
-Original Message-
From: Marcus Boerger [mailto:[EMAIL PROTECTED]
Sent: Friday, April 16, 2004 3:29 PM
To: Andi Gutmans
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] Re: [RFC] ifsetor operator
Hello Andi
Good call.
At 4/17/2004 01:17 AM +0300, Andi Gutmans wrote:
I don't want to spoil the party but:
a) I don't think we should add a new reserved word for this. I will try
and think of an alternative which uses the existing vocabulary.
b) I would not want to add this before releasing PHP 5.0.0. I th
Hello Andi,
Saturday, April 17, 2004, 12:17:49 AM, you wrote:
> I don't want to spoil the party but:
> a) I don't think we should add a new reserved word for this. I will try and
> think of an alternative which uses the existing vocabulary.
> b) I would not want to add this before releasing PHP 5
Argh! Guys, let's not use anything that just combines 2 existing
keywords. Being able to read stuff at a glance is important:
if exists(...)
ifexists(...)
or
else if(...)
ifelse(...)
these would do vastly different things but look alike, and that is ungood.
-Rasmus
On Sat, 17 Apr 20
I don't want to spoil the party but:
a) I don't think we should add a new reserved word for this. I will try and
think of an alternative which uses the existing vocabulary.
b) I would not want to add this before releasing PHP 5.0.0. I think we
should add it afterwards. We are not talking about a
On Fri, 16 Apr 2004, Edin Kadribasic wrote:
>
>On Friday, Apr 16, 2004, at 22:25 Europe/Copenhagen, Rasmus Lerdorf
>wrote:
>
>> On Fri, 16 Apr 2004, Derick Rethans wrote:
>>
>>> On Fri, 16 Apr 2004, Rasmus Lerdorf wrote:
>>>
> This would lead to
> $a = isset($b, 'default');
I th
Jason Garber wrote:
As Wez pointed out, this is almost ready to insert into the parser.
Most of yesterdays conversation was spent hashing out the ways that this
should be implemented.
Ok, now I'm confused. Why is an RFC (Request For Comment) posted to the
internals list if it was already decide
On Friday, Apr 16, 2004, at 22:25 Europe/Copenhagen, Rasmus Lerdorf
wrote:
On Fri, 16 Apr 2004, Derick Rethans wrote:
On Fri, 16 Apr 2004, Rasmus Lerdorf wrote:
This would lead to
$a = isset($b, 'default');
I think this is the sanest suggestion yet.
But it's already in use... (isset accepts mul
Chris -
As Wez pointed out, this is almost ready to insert into the parser. Most
of yesterdays conversation was spent hashing out the ways that this should
be implemented.
Remember, one of the biggest reasons for creating this function was so that
E_NOTICE would not be issued when attempting
On Fri, 16 Apr 2004, Derick Rethans wrote:
> On Fri, 16 Apr 2004, Rasmus Lerdorf wrote:
>
> > > This would lead to
> > > $a = isset($b, 'default');
> >
> > I think this is the sanest suggestion yet.
>
> But it's already in use... (isset accepts multiple parameters and does
> an AND on those).
A
Marcus Boerger wrote:
You cannot do this because that syntax is already defined for PHP
with another semantic.
Ok, missed that one, I never used multiple arguments to isset ;-)
Let's call it ifsetor, ifset or default then. But I still think allowing
a list of expressions is a good idea because bo
On Fri, 16 Apr 2004, Rasmus Lerdorf wrote:
> > This would lead to
> > $a = isset($b, 'default');
>
> I think this is the sanest suggestion yet.
But it's already in use... (isset accepts multiple parameters and does
an AND on those).
Derick
--
PHP Internals - PHP Runtime Development Mailing Lis
On Fri, 16 Apr 2004, Christian Schneider wrote:
> Derick Rethans wrote:
> > isset() works on a variable only too, so this behavior matches already
> > existing behavior.
>
> Hmm... this brings up another idea:
> Extend isset to have this behaviour. Funnily enough when I was thinking
> about such
Hello Christian,
Friday, April 16, 2004, 10:10:01 PM, you wrote:
> Derick Rethans wrote:
>> isset() works on a variable only too, so this behavior matches already
>> existing behavior.
> Hmm... this brings up another idea:
> Extend isset to have this behaviour. Funnily enough when I was thinking
Derick Rethans wrote:
isset() works on a variable only too, so this behavior matches already
existing behavior.
Hmm... this brings up another idea:
Extend isset to have this behaviour. Funnily enough when I was thinking
about such a feature I wished I could call it isset. And now I realize
that w
I completely agree with the EXACT way Marcus has proposed this operator.
The key is that the first argument must be a Variable, because it is tested
to see if it ISSET(), not if it's null. That is why you can't have any
expression for the first argument - it would be like calling isset('foo'),
On Fri, 16 Apr 2004, Christian Schneider wrote:
> Marcus Boerger wrote:
> > [RFC] ifsetor operator
> >
> > Synopsis: "ifsetor" "(" value "," default ")"
> > Returns the value if it exists or a given default value.
> > Syntax: "ifsetor" "(" variable [ "," expression ] ")"
> > Semantic:
> > -
Marcus Boerger wrote:
[RFC] ifsetor operator
Synopsis: "ifsetor" "(" value "," default ")"
Returns the value if it exists or a given default value.
Syntax: "ifsetor" "(" variable [ "," expression ] ")"
Semantic:
- The value in question must be a variable.
I'd prefer to not have this restrict
29 matches
Mail list logo