Re: return

From: Date: Tue, 17 Jul 2001 08:12:45 +0000
Subject: Re: return
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58215@lists.php.net to get a copy of this message
On 16 Jul 01, at 15:25, Tyler Longren wrote: > <? > function expDate($date) { > $month = substr("$date", 0, 2); > $len = strlen($date); > $year = substr("$date", $len-2, $len); > return $month; > return $year; > } > expDate("11/2002"); > print "$month $year"; > ?> <? function expDate($date) { $month = substr($date, 0, 2); $year = substr($date, strlen($date) - 2, 2); return "$month $year"; } $monyr = expDate("11/2002"); print "$monyr"; ?> would do it I expect. CYA, Dave ----------------------------------------------------------------------- Outback Queensland Internet - Longreach, Outback Queensland - Australia http://www.outbackqld.net.au mailto:dfreeman@outbackqld.net.au -----------------------------------------------------------------------

« previous php.general (#58215) next »