How to get total_basic from this array . i call it by $salary_master->$total_basic it is showing error telling undefined total_basic variable

common\models\MonthlySalary Object
(
[_attributes:yii\db\BaseActiveRecord:private] => Array
(
[id] => 297
[papl_id] => PAPL0000000294
[designation] =>
[plant_id] => 1
[from_date] =>
[to_date] =>
[month_year] => August 2021
[earning_detail] => []
[deduction_detail] => {“11”:0,“12”:0,“13”:0,“14”:“25.34”,“15”:“0.00”,“16”:“0.00”,“17”:“0.00”,“18”:“0.00”,“19”:“12.00”,“20”:“0.00”,“21”:“0.00”}
[total_basic] => 0
[total_gross] => 0
[misc_att] => 0
[misc_earning] => 0
[total_salary] => 0
[total_deduction] => 37
[net_payble] => -37
[lwf_refund] => 0
[esi_refund] => 0
[total_payble] => -37
[created_at] =>
[updated_at] =>
[created_by] =>
[updated_by] =>
)

[_oldAttributes:yii\db\BaseActiveRecord:private] => Array
    (
        [id] => 297
        [papl_id] => PAPL0000000294
        [designation] => 
        [plant_id] => 1
        [from_date] => 
        [to_date] => 
        [month_year] => August 2021
        [earning_detail] => []
        [deduction_detail] => {"11":0,"12":0,"13":0,"14":"25.34","15":"0.00","16":"0.00","17":"0.00","18":"0.00","19":"12.00","20":"0.00","21":"0.00"}
        [total_basic] => 0
        [total_gross] => 0
        [misc_att] => 0
        [misc_earning] => 0
        [total_salary] => 0
        [total_deduction] => 37
        [net_payble] => -37
        [lwf_refund] => 0
        [esi_refund] => 0
        [total_payble] => -37
        [created_at] => 
        [updated_at] => 
        [created_by] => 
        [updated_by] => 
    )

[_related:yii\db\BaseActiveRecord:private] => Array
    (
    )

[_relationsDependencies:yii\db\BaseActiveRecord:private] => Array
    (
    )

[_errors:yii\base\Model:private] => 
[_validators:yii\base\Model:private] => 
[_scenario:yii\base\Model:private] => default
[_events:yii\base\Component:private] => Array
    (
    )

[_eventWildcards:yii\base\Component:private] => Array
    (
    )

[_behaviors:yii\base\Component:private] => Array
    (
    )

)

$salary_master->$total_basic property accessed as variable which should be $salary_master->total_basic. Learn to debug the code. it’s a typo.

sorry not checked that.