suppose I have a function like
function crear($first, $second, $third, $fourth, $fifth, $sixth){
$sixth= ($sixth > 0 ? "<span class='required'>*</span>" : "");
if($fourth=='input'){
echo "\t <div class='field-box ".$third."' id='".$first."_field_box'>
";
echo "\t\t <div class='display-as-box' id='".$first."_display_as_box'>".$second." ".$sixth.":</div>
";
echo "\t\t <div class='input-box' id='".$first."_input_box'>
";
echo "\t\t <input id='field-".$first."' name='".$first."' type='text' maxlength='".$fifth."' /> </div><div class='clear'></div>
";
echo "\t </div>
";
}
}
And I am calling it several times:
crear('title1', 'Title 1','odd', 'input', '50', 0 );
crear('title2', 'Title 2','even', 'input', '50', 0 );
crear('title3', 'Title 3','odd', 'input', '30', 1 );
crear('title4', 'Title 4','even', 'input', '50', 0 );
crear('title5', 'Title 5','odd', 'select', '19', 1 );
crear('title6', 'Title 6','even', 'select', '19', 0 );
How could I make only one call to this function passing all this data.
I was thinking to make an array but I woul have to modify the function, What would be the best way... The only one I easily can suppose is odd and even field, the others got to be variables.