Re: [PHP] Problems with split

2001-08-13 Thread Dan Lowe

Previously, Ville Mattila said:
 ---
 $invdate = 14.8.2001;
 echo $invdate\n;
 list($day, $month, $year) = split(., $invdate);
 echo $year-$month-$day;
 ---
 Somehow, the second echo outputs only -- as it should be 2001-8-14.
 Any idea why this happen and how this could be avoided?

Change the third line to read:

list($day, $month, $year) = split(\., $invdate);

 -dan

-- 
What do you do when you see an endangered animal eating an endangered plant?
 -George Carlin

-- 
PHP General 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] Problems with split

2001-08-13 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Dan Lowe) wrote:

  $invdate = 14.8.2001;
  echo $invdate\n;
  list($day, $month, $year) = split(., $invdate);
  echo $year-$month-$day;
  ---
  Somehow, the second echo outputs only -- as it should be 2001-8-14.
  Any idea why this happen and how this could be avoided?
 
 Change the third line to read:
 
 list($day, $month, $year) = split(\., $invdate);

Or change:
split(., $invdate)

To:
explode(., $invdate)

Since you aren't using the regex overhead anyway.

-- 
CC

-- 
PHP General 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]