Re: [PHP-DEV] PHP 4.0 Bug #9195: Default class function arguments

2001-02-09 Thread Zeev Suraski

No, it's more complicated than that.  Actually, it's not that complicated 
if you explain it the other way around:

- The only case in which a char-by-char comparison is made, is if both 
arguments are strings, and at least one of them doesn't "look" like a number.

Or, in other words:

- If at least one of the arguments is not a string, a numeric comparison is 
made.
- If both arguments are strings, but both of them look like numbers, a 
numeric comparison is made.
- If both arguments are strings (and at least one of them doesn't look like 
a number), a string comparison is made.

Zeev


At 20:25 9/2/2001, Zak Greant wrote:
>After doing a few tests and some reading, it looks like the rule is pretty
>simple:
>
>If either expression on either side of a == operator looks like a number,
>then the value of the expression is converted to a number.
>
>--zak
>
>- Original Message -
>From: "Zeev Suraski" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>Sent: Friday, February 09, 2001 11:06 AM
>Subject: Re: [PHP-DEV] PHP 4.0 Bug #9195: Default class function arguments
>
>
> > Default function arguments have to be static, non dynamic values.  The way
> > to do it is
> >
> > function foo($bar=unset)
> > {
> >  if (!isset($bar)) {
> >  $bar = ...;
> >  }
> > }
> >
> > At 20:00 9/2/2001, [EMAIL PROTECTED] wrote:
> > >From: [EMAIL PROTECTED]
> > >Operating system: Linux
> > >PHP version:  4.0.2
> > >PHP Bug Type: Feature/Change Request
> > >Bug description:  Default class function arguments
> > >
> > >I'm requesting that the default function arguments for a class method be
> > >able to reference the class variable members in it's definition.
> > >
> > >Here is an example of it's use:
> > >
> > >class searchclass {
> > >
> > > var $hits;
> > > var $results;
> > >
> > > function save($filename, $start = 0, $end = $this->hits){ /* <-
> > > this returns Parse error: */
> > > if($fp = @fopen($filename, "w")){
> > > for($i = $start; $i < $end; $i++){
> > > fwrite($fp, implode("|",
> > > $this->results[$i]));
> > > }
> > > }else{
> > > return false;
> > > }
> > > }
> > >
> > > function search(){
> > > /* ... */
> > > }
> > >
> > >}
> > >
> > >
> > >--
> > >Edit Bug report at: http://bugs.php.net/?id=9195&edit=1
> > >
> > >
> > >
> > >--
> > >PHP Development Mailing List <http://www.php.net/>
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Zeev Suraski <[EMAIL PROTECTED]>
> > CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >

--
Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] PHP 4.0 Bug #9195: Default class function arguments

2001-02-09 Thread Zak Greant

After doing a few tests and some reading, it looks like the rule is pretty
simple:

If either expression on either side of a == operator looks like a number,
then the value of the expression is converted to a number.

--zak

- Original Message -
From: "Zeev Suraski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, February 09, 2001 11:06 AM
Subject: Re: [PHP-DEV] PHP 4.0 Bug #9195: Default class function arguments


> Default function arguments have to be static, non dynamic values.  The way
> to do it is
>
> function foo($bar=unset)
> {
>  if (!isset($bar)) {
>  $bar = ...;
>  }
> }
>
> At 20:00 9/2/2001, [EMAIL PROTECTED] wrote:
> >From: [EMAIL PROTECTED]
> >Operating system: Linux
> >PHP version:  4.0.2
> >PHP Bug Type: Feature/Change Request
> >Bug description:  Default class function arguments
> >
> >I'm requesting that the default function arguments for a class method be
> >able to reference the class variable members in it's definition.
> >
> >Here is an example of it's use:
> >
> >class searchclass {
> >
> > var $hits;
> > var $results;
> >
> > function save($filename, $start = 0, $end = $this->hits){ /* <-
> > this returns Parse error: */
> > if($fp = @fopen($filename, "w")){
> > for($i = $start; $i < $end; $i++){
> > fwrite($fp, implode("|",
> > $this->results[$i]));
> > }
> > }else{
> > return false;
> > }
> > }
> >
> > function search(){
> > /* ... */
> > }
> >
> >}
> >
> >
> >--
> >Edit Bug report at: http://bugs.php.net/?id=9195&edit=1
> >
> >
> >
> >--
> >PHP Development Mailing List <http://www.php.net/>
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> Zeev Suraski <[EMAIL PROTECTED]>
> CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] PHP 4.0 Bug #9195: Default class function arguments

2001-02-09 Thread Zeev Suraski

Default function arguments have to be static, non dynamic values.  The way 
to do it is

function foo($bar=unset)
{
 if (!isset($bar)) {
 $bar = ...;
 }
}

At 20:00 9/2/2001, [EMAIL PROTECTED] wrote:
>From: [EMAIL PROTECTED]
>Operating system: Linux
>PHP version:  4.0.2
>PHP Bug Type: Feature/Change Request
>Bug description:  Default class function arguments
>
>I'm requesting that the default function arguments for a class method be 
>able to reference the class variable members in it's definition.
>
>Here is an example of it's use:
>
>class searchclass {
>
> var $hits;
> var $results;
>
> function save($filename, $start = 0, $end = $this->hits){ /* <- 
> this returns Parse error: */
> if($fp = @fopen($filename, "w")){
> for($i = $start; $i < $end; $i++){
> fwrite($fp, implode("|", 
> $this->results[$i]));
> }
> }else{
> return false;
> }
> }
>
> function search(){
> /* ... */
> }
>
>}
>
>
>--
>Edit Bug report at: http://bugs.php.net/?id=9195&edit=1
>
>
>
>--
>PHP Development Mailing List 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]