Estou tentando trabalhar com arrays porem estou com dificuldade para acessar os itens ou eles veem agrupados ou eles geram diversas arrays, as quais não consigo acessar.
CONTROLLER
$listaDescontos = $dados['listTabelaDesconto'];
foreach($listaDescontos as $key => $value){
$listDesc = $value['usu_tabdsc'];
$dados['listFPG'] = (new Step3Model)->getAllFormaPagamentoLocal($_SESSION['filial'],$listDesc);
$list = $dados['listFPG'];
foreach($list as $keyList ){
$teste = $keyList;
print_r( $teste);
//$dados['listFormaPgto'] = $valueList;
}
}
VIEW
foreach($listFormaPgto as $item) {
if(isset($_POST['formaPgto']) && $_POST['formaPgto'] == $item['codfpg']){
$selected = 'selected';
} else if(isset($currentPedido) && $currentPedido['codfpg'] == $item['codfpg']){
$selected = 'selected';
} else {
$selected = '';
}
echo '<option value="'.$item['codfpg'].'" '.$selected.'>'.$item['desfpg'].'</option>';
}
ARRAY RESULTANTE
Array ( [codfpg] => 9 [0] => 9 [desfpg] => VALE OF [1] => VALE OF [usu_moefpg] => AU [2] => AU ) Array ( [codfpg] => 1 [0] => 1 [desfpg] => Cobranca Bancaria [1] => Cobranca Bancaria [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 3 [0] => 3 [desfpg] => Deposito em Conta [1] => Deposito em Conta [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 5 [0] => 5 [desfpg] => Dinheiro [1] => Dinheiro [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 6 [0] => 6 [desfpg] => VALE RS [1] => VALE RS [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 7 [0] => 7 [desfpg] => CHEQUE [1] => CHEQUE [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 10 [0] => 10 [desfpg] => Cartao Debito [1] => Cartao Debito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 11 [0] => 11 [desfpg] => Cartao Credito [1] => Cartao Credito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 99 [0] => 99 [desfpg] => Crediario [1] => Crediario [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 1 [0] => 1 [desfpg] => Cobranca Bancaria [1] => Cobranca Bancaria [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 3 [0] => 3 [desfpg] => Deposito em Conta [1] => Deposito em Conta [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 5 [0] => 5 [desfpg] => Dinheiro [1] => Dinheiro [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 6 [0] => 6 [desfpg] => VALE RS [1] => VALE RS [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 7 [0] => 7 [desfpg] => CHEQUE [1] => CHEQUE [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 10 [0] => 10 [desfpg] => Cartao Debito [1] => Cartao Debito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 11 [0] => 11 [desfpg] => Cartao Credito [1] => Cartao Credito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 99 [0] => 99 [desfpg] => Crediario [1] => Crediario [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 1 [0] => 1 [desfpg] => Cobranca Bancaria [1] => Cobranca Bancaria [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 3 [0] => 3 [desfpg] => Deposito em Conta [1] => Deposito em Conta [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 5 [0] => 5 [desfpg] => Dinheiro [1] => Dinheiro [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 6 [0] => 6 [desfpg] => VALE RS [1] => VALE RS [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 7 [0] => 7 [desfpg] => CHEQUE [1] => CHEQUE [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 10 [0] => 10 [desfpg] => Cartao Debito [1] => Cartao Debito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 11 [0] => 11 [desfpg] => Cartao Credito [1] => Cartao Credito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 99 [0] => 99 [desfpg] => Crediario [1] => Crediario [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 1 [0] => 1 [desfpg] => Cobranca Bancaria [1] => Cobranca Bancaria [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 3 [0] => 3 [desfpg] => Deposito em Conta [1] => Deposito em Conta [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 5 [0] => 5 [desfpg] => Dinheiro [1] => Dinheiro [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 6 [0] => 6 [desfpg] => VALE RS [1] => VALE RS [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 7 [0] => 7 [desfpg] => CHEQUE [1] => CHEQUE [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 10 [0] => 10 [desfpg] => Cartao Debito [1] => Cartao Debito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 11 [0] => 11 [desfpg] => Cartao Credito [1] => Cartao Credito [usu_moefpg] => 01 [2] => 01 ) Array ( [codfpg] => 99 [0] => 99 [desfpg] => Crediario [1] => Crediario [usu_moefpg] => 01 [2] => 01 )
Preciso de pegar as informações como desfpg, codfpg, usu_moefpg em variáveis porem não estou obtendo sucesso procedendo desta forma. HELP!