У меня есть многомерный массив, и я хочу преобразовать только определенные ключи c в многомерный массив.
Вот пример многомерного массива:
array (
0 =>
array (
'id' => 0,
'payment_method' => 2,
'amount' => 100,
'check_no' => '',
'remarks' => '',
'check_date' => '2020-01-13',
'bank_account_id' => NULL,
'surcharge_id' => NULL,
'card_number' => '',
'customer_name' => '',
'merchant_number' => '',
'batch_number' => '',
'approval_number' => '',
'other_reference_1' => '',
'other_reference_3' => '',
'other_reference_2' => '',
'based_amount' => 0,
'actual_amount' => 0,
'total_charge' => 0,
'transaction_id' => 47,
'transaction_status' => 0,
),
1 =>
array (
'id' => 0,
'payment_method' => 2,
'amount' => 150,
'check_no' => '',
'remarks' => '',
'check_date' => '2020-01-13',
'bank_account_id' => NULL,
'surcharge_id' => NULL,
'card_number' => '',
'customer_name' => '',
'merchant_number' => '',
'batch_number' => '',
'approval_number' => '',
'other_reference_1' => '',
'other_reference_3' => '',
'other_reference_2' => '',
'based_amount' => 0,
'actual_amount' => 0,
'total_charge' => 0,
'transaction_id' => 47,
'transaction_status' => 0,
),
2 =>
array (
'id' => 0,
'payment_method' => 2,
'amount' => 100,
'check_no' => '',
'remarks' => '',
'check_date' => '2020-01-13',
'bank_account_id' => NULL,
'surcharge_id' => NULL,
'card_number' => '',
'customer_name' => '',
'merchant_number' => '',
'batch_number' => '',
'approval_number' => '',
'other_reference_1' => '',
'other_reference_3' => '',
'other_reference_2' => '',
'based_amount' => 0,
'actual_amount' => 0,
'total_charge' => 0,
'transaction_id' => 47,
'transaction_status' => 0,
)
)
Я только хочу указать c ключи для преобразования, например, я хочу только транзакции_id, транзакции_статуса, суммы и т. д. c.
Тогда ожидаемый результат будет:
array (
0 =>
array (
'transaction_id' => 47,
'transaction_status' => 0,
'amount' => 100
),
1 =>
array (
'transaction_id' => 47,
'transaction_status' => 0,
'amount' => 100
),
2 =>
array (
'transaction_id' => 47,
'transaction_status' => 0,
'amount' => 100
)
)
Спасибо! !