Please take a look at this piece of code. My question is in the constructor, inside the foreach. Am I creating variables this way?
For example, is the array is like:
$form_args_array[type1]= value1;
$form_args_array[type2]= value2;
$form_args_array[type3]= value3;
then I will have this variables??? ok??
$this->type1= value1
$this->type2= value2
$this->type3= value3
But , If for my second instance I change the input array, I`ll have two instances of the same class with completely different variables. Is this posible?
or the values of the array MUST contain one of the predefined variables defined earlier in the class?
class StdForm {
var $name; // Nombre del formulario
var $fields_array; // Array de campos
var $FORMPATH; // Path donde están los archivos de este form
var $std_evaluate; // ¿Evaluar campos obligatorios y pictures?
#-> Constructor
function StdForm($form_args_array)
{
$this->name = $form_args_array[form_name]; //Por compatibilidad
foreach($form_args_array as $arg => $value) {
$this->$arg = $value;
}
Thanks for your help.