我想使用var_export()函数并去掉数组中所有数字键。我的数组输出如下:
array (
2 =>
array (
1 =>
array (
'infor' => 'Radiation therapy & chemo subhead',
'PPOWithNotif' => '',
'PPOWithOutNotif' => 'Radiation therapy & chemo PPO amount',
'NonPPO' => 'Radiation therapy & chemo Non PPO amount',
),
),
3 =>
array (
1 =>
array (
'infor' => 'Allergy testing & treatment subhead',
'PPOWithNotif' => '',
'PPOWithOutNotif' => 'Allergy testing & treatment PPO amount',
'NonPPO' => 'Allergy testing & treatment Non PPO amount',
),
)
)
通过这种方法,我可以随意地打乱数组的值,而无需担心数字数组值的情况。
我尝试使用
echo preg_replace("/[0-9]+ \=\>/i", '', var_export($data));
,但它没有任何作用。您有什么建议吗?我的正则表达式是否有问题?总体上,是否有更好的解决方案?