我需要的
我实施的代码:
use Symfony\Component\Intl\Intl;
\Locale::setDefault('en');
$currencies = Intl::getCurrencyBundle()->getCurrencyNames();
$currency = Intl::getCurrencyBundle()->getCurrencyName('INR');
$symbol = Intl::getCurrencyBundle()->getCurrencySymbol('INR');
$fractionDigits = Intl::getCurrencyBundle()->getFractionDigits('INR');
$roundingIncrement = Intl::getCurrencyBundle()->getRoundingIncrement('INR');
Run Code Online (Sandbox Code Playgroud)
错误:
未实现Symfony\Component\Intl\Locale\Locale :: setDefault().请安装"intl"扩展名以获得完整的本地化功能.
500内部服务器错误 - MethodNotImplementedException
OS配置:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.04
DISTRIB_CODENAME=raring
DISTRIB_DESCRIPTION="Ubuntu 13.04"
NAME="Ubuntu"
VERSION="13.04, Raring Ringtail"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 13.04"
VERSION_ID="13.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
Run Code Online (Sandbox Code Playgroud)
我需要的
数组结构
[0] => Array
(
[type] => CACDA
[metadata] => Array
(
[0] => Array
(
[amount] => 320
[comment] =>
)
)
)
[1] => Array
(
[type] => CVMA
[metadata] => Array
(
[0] => Array
(
[amount] => 320
[comment] => Onsite After February 20
)
)
)
Run Code Online (Sandbox Code Playgroud)源代码
unset($data[0]);
//store types and the arrays the belong to
foreach($data as $k=>$v){
$type[$v['type']][]=$k;
}
//loop types, creating result array
foreach($type as $k=>$v){
$tmp=array(
'type'=>$k,
'metadata'=>array() …Run Code Online (Sandbox Code Playgroud) 我需要的
这是数组结构(未设置之前)
[0] => Array
(
[currency] => INR
)
[1] => Array
(
[type] => General Public Tickets Adult
[amount] => 50
[comment] => (Working Days)
)
[2] => Array
(
[type] => General Public Tickets Adult
[amount] => 80
[comment] => (Saturday/ Sunday/ Holiday)
)
Run Code Online (Sandbox Code Playgroud)
这是数组结构(未设置后)
[1] => Array
(
[type] => General Public Tickets Adult
[amount] => 50
[comment] => (Working Days)
)
[2] => Array
(
[type] => General Public Tickets Adult
[amount] => 80 …Run Code Online (Sandbox Code Playgroud)