Good, I need to save in a variable the specific value of an array in another variable
From here I receive the data:
$data = \DB::select("
SELECT
SUM(CASE WHEN status like 'Por Despachar' THEN 1 ELSE 0 END) AS Por_Despachar
,SUM(CASE WHEN status like 'Planificado' THEN 1 ELSE 0 END) AS Planificado
,SUM(CASE WHEN status like 'Despachado' THEN 1 ELSE 0 END) AS Despachado
FROM presupuesto
");
Obtengo 3 valores por cada condicion
Quiero guardar el valor De planificado en otra variable es solo eso
$dta = [];
foreach($data as $d) {array_push($dta, $d);}
I get this:
array:1 [▼
0 => {#330 ▼
+"por_despachar": "4"
+"planificado": "1"
+"despachado": "0"
}
]
I need something like that
$intval1 = dta[1]; <--- guardar el valor especifico deacuerdo al indice
but I get this Error:
Undefined offset: 1
example then if dta [1] has a value of 5 and I show on screen $ intval1 should show:
5