RE: [PHP] Passing array to function

2002-08-13 Thread Ford, Mike [LSS]

 -Original Message-
 From: Bill Hudspeth [mailto:[EMAIL PROTECTED]]
 Sent: 13 August 2002 17:10

[]

 DESIRED FUNCTION VERSION
 
 
 
 $elementname=cgroup_1[];
 
 $elementsarray=$chon_group_a;
 
 PrintOptionBox($elementname,$elementsarray);

Well, looks ok-ish so far -- what's in the PrintOptionBox function, and how
exactly does it fail (intended vs actual results)?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




Re: [PHP] passing array to function?

2001-02-06 Thread David Robley

On Wed,  7 Feb 2001 11:30, Jaxon wrote:
 How do you write a function that takes an array as an argument?

 Could someone please point me at an example?

 Regards,
 Jaxon

Try this:

?php 
function show_elements($ary) {
while(list($key,$val) = each($ary)) {
echo "$key = $valBR";
}
}

$fruits=array("a"="apple","b"="banana","c"="cucumber","d"="apricot",);
show_elements($fruits);
?

That's pretty much plagiarised from the array functions in the manual :-)

-- 
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

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