0
Hello!
There is the possibility of joining array’s ?
If yes how can I do ?
What I got
Array
(
[Dashboard_1] => 1
)
Array
(
[Configuração_2] => 1
)
Array
(
[Usuário_3] => 1
)
Array
(
[Criar_4] => 1
)
Array
(
[Editar_5] => 1
)
Array
(
[Excluir_6] => 1
)
Array
(
[Visualizar_7] => 1
)
What I desire
Array
(
[Dashboard_1] => 1
[Configuração_2] => 1
[Usuário_3] => 1
[Criar_4] => 1
[Editar_5] => 1
[Excluir_6] => 1
[Visualizar_7] => 1
)
Function
// edit_jstree
public function edit_jstree($dados, $permissao_id)
{
//print_r($dados);
$array = (array) $dados;
foreach ($dados as $js)
{
$jstree = [
'acesso' => $js['state']->selected,
];
$this->db->where('identificacao', $js['id']);
$this->db->where('permissao_id', $permissao_id);
$this->db->update('tb_jstree', $jstree);
$array_chave = $js['text'].'_'.$js['id']; // concatena texto + identifiacao para montar a chave do array
$array = [
"$array_chave" => $js['state']->selected,
];
$array_serialize = serialize($array);
print_r($array_serialize);
}
}
Use the
array_merge
– Valdeir Psr
I’ve tried, but from what I understand, by following the manual,
array_merge
needs two parameters, and I only have one$array
.– Wagner Fillio
The array_merge function only has a "required" parameter (Combines one or more arrays).
– Márcio Amaral da Fonseca