I have a function like this:
function form($filename){
$text="";
if (file_exists(dirname(__FILE__)."/other/".$filename)){
ob_start();
include "other/".$filename;
$text = ob_get_clean();
}
return $text;
}
And, somewhere in my code, I have something like that:
class First {
public function execute()
$an_array=array("hi","goodbye");
return form("my_form.php");
}
Now I would like to know how I could get the values of $an_array
on my "my_form.php".
The function form
is to be used with other files that could need more then one variable.
EDIT
I want that the included file could read more then one parameter. In other words, on some other class, I could have something like this:
class Second {
public function execute()
$first_array=array("hi","goodbye");
$second_array=array("other","another");
return form("another_form.php");
}
In this case, I would like to read both $first_array
and $second_array
on my another_form.php
file.
EDIT 2
Is there any way to make my form
function work like php's array_push
function? In other words, I want to have a second parameter on form
that acts like the last parameter of array_push
.