我想 轉換這個字符串:將字符串轉換多維數組
$credit_packages_string = "300,0.25|1000,0.24|3000,0.22|4000,0.20|5000,0.18|6000,0.16|7000,0.14";
這個數組:
$credit_packages = array( array('credit_amount'=> 300,
'price_per_credit'=>0.25),
array('credit_amount'=> 1000,
'price_per_credit'=>0.24),
array('credit_amount'=> 3000,
'price_per_credit'=>0.22),
array('credit_amount'=> 4000,
'price_per_credit'=>0.20),
array('credit_amount'=> 5000,
'price_per_credit'=>0.18),
array('credit_amount'=> 6000,
'price_per_credit'=>0.16),
array('credit_amount'=> 7000,
'price_per_credit'=>0.14)
);
你會如何以最有效的方式做到這一點?
已經有** ** 7和意見** 4 **回答截至目前:) – codaddict 2010-10-10 04:28:44