Passing an array as an argument

From: Date: Thu, 14 Mar 2002 16:29:53 +0000
Subject: Passing an array as an argument
Groups: php.general 
Request: Send a blank email to php-general+get-88541@lists.php.net to get a copy of this message
Hello, I've built a function that receives an array as an argument to create an HTML drop-down list, but when I try to print the list this is all I got: <select name="my_list"> <option value="Array[0]">Array[1] <option value="Array[0]">Array[1] </select> This is my code: ------------------- Function TextList($sName, $aOptions) { $nCount = Count($aOptions); //Counts the elements of the array Print(" <select name=\"$sName\">\n"); For ($i = 1; $i <= $nCount; $i++) { Print(" <option value=\"$aOptions[1][0]\">$aOptions[1][1]\n"); } Print(" </select>\n"); } */ Now I build the array */ $my_array = Array( Array(0,0), Array(1,"Enero"), Array(2,"Febrero"), Array(3,"Marzo"), Array(4,"Abril"); */ And call the function */ TextList("my_list", $my_array); I need to know how exaclty can I pass and receive an array as a function argument. Hope you can help me, TIA. -- Mauricio Cuenca

« previous php.general (#88541) next »