Tutorial :Is it possible to delay variable implement(?)/recognize(?) in PHP?



Question:

For example:

A.php (the config file):

<?php  $a = array('name'=>'wine[$index][name]',             'value'=>'wine[$index][value]'            )  ?>  

B.php:

include_once(a.php)  ...  //for simple  $index = 0;  $b = $a;    //actual code like  foreach($data as $index=>$value)     $b += $a  

I know this example won't work, just for explaination, i wanna if it is possible (if possible, how?) to delay variable $index to take value when $b = $a ?


Solution:1

make "a" a function

 function a($index) { global $data; return $data[$index] ... }     $b = a($index);  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »