In bash, you can include a variable as part of a filename. For
example:
date=$(date)
cat log.txt > $date"_log.txt"
Which, when setting the right options in date, creates a file named
20040705_log.txt
I am now trying to call a class based on a previously defined variable
set by an array:
1 $field[1] = "first_name";
7 $field[2] = "mi";
8 $field[3] = "last_name";
12 foreach ($field as $field_name) {
13 $var_validate_field = &New "cls_validate_"$field_name;
14 $var_strip_field = &New "cls_strip_"$field_name;
15 $record[$field_name] = $_POST[$field_name];
16 $record_check[$field_name] =
$var_validate_field->fn_validate($record[$field_name]);
17 $record[$field_name] =
$var_strip_field->fn_strip($record[$field_name]);
18 print "<p>$field_name is $record[$field_name] and its check is
$record_check[$field_name]";
19 }
As you can see, I am trying to make $field_name part of the name of
the class, but it is not working. Everything else works fine; I've
tested the classes individually; but the array method will not work
without this. Suggestions are welcome. Thank you.