<?php
$array = array
(
1 => array
(
'amount' => 0,
'date' => '2023-01-08',
'amount_discount' => 55200,
'amount_fine' => 0,
'description' => '',
'collected_by' => 'Super Admin(356)',
'payment_mode' => 'Cash',
'received_by' => 1,
'inv_no' => 1
),
2 => array
(
'amount' => 36800,
'date' => '2023-01-08',
'description' => 'Collected By: Super Admin',
'amount_discount' => 0,
'amount_fine' => 0,
'payment_mode' => 'Cash',
'received_by' => 1,
'inv_no' => 2
)
);
//sample code to just create stdclass array like you, so don't use it
$array = json_decode(json_encode($array));
print_r($array);
echo $discount = current( (Array)$array )->amount_discount;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/8Wvqv
function name: (null)
number of ops: 19
compiled vars: !0 = $array, !1 = $discount
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > ASSIGN !0, <array>
33 1 INIT_FCALL 'json_decode'
2 INIT_FCALL 'json_encode'
3 SEND_VAR !0
4 DO_ICALL $3
5 SEND_VAR $3
6 DO_ICALL $4
7 ASSIGN !0, $4
34 8 INIT_FCALL 'print_r'
9 SEND_VAR !0
10 DO_ICALL
36 11 INIT_FCALL 'current'
12 CAST 7 ~7 !0
13 SEND_VAL ~7
14 DO_ICALL $8
15 FETCH_OBJ_R ~9 $8, 'amount_discount'
16 ASSIGN ~10 !1, ~9
17 ECHO ~10
37 18 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
155.46 ms | 939 KiB | 22 Q