新しいphpファイルに引数として配列を渡そうとしています。
$data=array('arr1'=>'haha', 'arr2'=>'wawa');
function load($view='index',$data=false){
require $view.'.php';
if (isset($data)){
//I want to pass $data(array) to index.php so I can use the array
//in index.php page.
//not sure what to do here.
}
}
load('index', $data);
index.php
<html>
echo '$arr1 ='.$arr1;
echo '$arr2 ='.$arr2;
</html>
これは可能ですか?助けてくれてありがとう。