<?php $string = '200AUD, 150USD, 80GBP, 1250000VND'; var_export( array_reduce( explode(',', $string), function ($result, $money) { sscanf($money, '%d%s', $amount, $currency); return $result + [$currency => $amount]; }, [] ) );
You have javascript disabled. You will not be able to edit any code.