[PHP] looping through array with list()/each()

2002-09-25 Thread Kevin Porter

OK so I've done this hundreds of times, but this time I cannot get it to
work.

Please cast an eye over the following code and output and tell me why $k and
$v are not being set:


Code:
-

$ser = array( 'first', 'second', 'third', 'fourth', 'fifth' );

reset($ser);
while ( list($key, $val) = each($ser) );
{
echo \$key = $key, \$val = $valbr;
}

-


Output:
--

$key = , $val =

--

I tried giving the $ser array numeric keys and string keys, both made no
difference.


thanks,

- Kev


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] looping through array with list()/each()

2002-09-25 Thread Kevin Porter

I meant $key and $val of course :o)

- Kev

 -Original Message-
 From: Kevin Porter [SMTP:[EMAIL PROTECTED]]
 Sent: 25 September 2002 12:00
 To:   '[EMAIL PROTECTED]'
 Subject:  [PHP] looping through array with list()/each()
 
 OK so I've done this hundreds of times, but this time I cannot get it to
 work.
 
 Please cast an eye over the following code and output and tell me why $k
 and
 $v are not being set:
 
 
 Code:
 -
 
 $ser = array( 'first', 'second', 'third', 'fourth', 'fifth' );
 
 reset($ser);
 while ( list($key, $val) = each($ser) );
 {
 echo \$key = $key, \$val = $valbr;
 }
 
 -
 
 
 Output:
 --
 
 $key = , $val =
 
 --
 
 I tried giving the $ser array numeric keys and string keys, both made no
 difference.
 
 
 thanks,
 
 - Kev
 
 
 **
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please notify
 the system manager.
 This footnote also confirms that this email message has been swept by
 MIMEsweeper for the presence of computer viruses.
 www.mimesweeper.com
 **
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] looping through array with list()/each()

2002-09-25 Thread Karl Phillipson

while ( list($key, $val) = each($ser) ); --- ; should not be here

-Original Message-
From: Kevin Porter [mailto:[EMAIL PROTECTED]]
Sent: 25 September 2002 12:13
To: Kevin Porter; '[EMAIL PROTECTED]'
Subject: RE: [PHP] looping through array with list()/each()


I meant $key and $val of course :o)

- Kev

 -Original Message-
 From: Kevin Porter [SMTP:[EMAIL PROTECTED]]
 Sent: 25 September 2002 12:00
 To:   '[EMAIL PROTECTED]'
 Subject:  [PHP] looping through array with list()/each()
 
 OK so I've done this hundreds of times, but this time I cannot get it to
 work.
 
 Please cast an eye over the following code and output and tell me why $k
 and
 $v are not being set:
 
 
 Code:
 -
 
 $ser = array( 'first', 'second', 'third', 'fourth', 'fifth' );
 
 reset($ser);
 while ( list($key, $val) = each($ser) );
 {
 echo \$key = $key, \$val = $valbr;
 }
 
 -
 
 
 Output:
 --
 
 $key = , $val =
 
 --
 
 I tried giving the $ser array numeric keys and string keys, both made no
 difference.
 
 
 thanks,
 
 - Kev
 
 
 **
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please notify
 the system manager.
 This footnote also confirms that this email message has been swept by
 MIMEsweeper for the presence of computer viruses.
 www.mimesweeper.com
 **
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] looping through array with list()/each()

2002-09-25 Thread Kevin Porter

Thank you, thank you, thank you.

And, er, D'oh! :o)

- Kev

 -Original Message-
 From: Karl Phillipson [SMTP:[EMAIL PROTECTED]]
 Sent: 25 September 2002 12:13
 To:   [EMAIL PROTECTED]
 Subject:  RE: [PHP] looping through array with list()/each()
 
 while ( list($key, $val) = each($ser) ); --- ; should not be here
 
 -Original Message-
 From: Kevin Porter [mailto:[EMAIL PROTECTED]]
 Sent: 25 September 2002 12:13
 To: Kevin Porter; '[EMAIL PROTECTED]'
 Subject: RE: [PHP] looping through array with list()/each()
 
 
 I meant $key and $val of course :o)
 
 - Kev
 
  -Original Message-
  From:   Kevin Porter [SMTP:[EMAIL PROTECTED]]
  Sent:   25 September 2002 12:00
  To: '[EMAIL PROTECTED]'
  Subject:[PHP] looping through array with list()/each()
  
  OK so I've done this hundreds of times, but this time I cannot get it to
  work.
  
  Please cast an eye over the following code and output and tell me why $k
  and
  $v are not being set:
  
  
  Code:
  -
  
  $ser = array( 'first', 'second', 'third', 'fourth', 'fifth' );
  
  reset($ser);
  while ( list($key, $val) = each($ser) );
  {
  echo \$key = $key, \$val = $valbr;
  }
  
  -
  
  
  Output:
  --
  
  $key = , $val =
  
  --
  
  I tried giving the $ser array numeric keys and string keys, both made no
  difference.
  
  
  thanks,
  
  - Kev
  
  
  **
  This email and any files transmitted with it are confidential and
  intended solely for the use of the individual or entity to whom they
  are addressed. If you have received this email in error please notify
  the system manager.
  This footnote also confirms that this email message has been swept by
  MIMEsweeper for the presence of computer viruses.
  www.mimesweeper.com
  **
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 **
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please notify
 the system manager.
 This footnote also confirms that this email message has been swept by
 MIMEsweeper for the presence of computer viruses.
 www.mimesweeper.com
 **
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php