This is a discussion on Execute command from array within the PHP General forums, part of the PHP Programming Forums category; I have an array, say something like this (to build a form): $commands = array( "Start Date" => "...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have an array, say something like this (to build a form):
$commands = array( "Start Date" => "build_date('startdate')", "End Date" => "build_date('enddate')" ); Only it will have many more entries. I want to cycle through the array, and print the first part, but then execute the second part so that it goes to the function build_date (which returns html code to output). Right now I am doing it something like this: echo "<tr><td>Start date</td><td>"; echo build_date('startdate'); echo "</td><td>End date</td><td>"; echo build_date('enddate'); echo "</td></tr>"; Because this is going to have many entries in it, it is getting very repetitive to do it this way! I am stuck on how to execute that function (and pass the string) with it already being a string itself. Any ideas? |