Welcome Guest, Not a member yet? Register   Sign In
Where store a lot of arrays?
#7

(This post was last modified: 12-27-2017, 07:07 AM by XtreemDeveloper.)

You can manage these array values by database. If you are use database for store these array than you can easily call tham as needed.

Also you can handle these arrays by helper.

You can create a function in helper file

function handleArrayValues($array_type) {
//helper file code
if($array_type == "someArray") {
$someArray = [...];
return $someArray;
} else if($array_type == "anotherArray") {
$anotherArray = [...];
return $anotherArray;
} else if($array_type == "thirdArray") {
$thirdArray = [...];
return $thirdArray;
} else {
return false;
}
}


//get arary as you want (where you want)
handleArrayValues("anotherArray");


Second option you can create these array in model and you can load that model in autoload file for access where in project.

//Model code
private $someArray = [...];

private $anotherArray = [...];

private $thirdArray = [...];

function getArray($type) 
{
   $array = $this->{$type};
   return $array;
}

//get arary as you want (where you want)
$this->model_name->getArray($thirdArray);
Reply


Messages In This Thread
Where store a lot of arrays? - by emilovbg - 11-12-2017, 06:51 AM
RE: Where store a lot of arrays? - by PaulD - 11-12-2017, 06:56 AM
RE: Where store a lot of arrays? - by emilovbg - 11-12-2017, 07:09 AM
RE: Where store a lot of arrays? - by PaulD - 11-12-2017, 07:17 AM
RE: Where store a lot of arrays? - by averroez - 11-14-2017, 12:26 AM
RE: Where store a lot of arrays? - by XtreemDeveloper - 12-20-2017, 10:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB