在Perl中,我可以将一个列表分配给哈希表中的多个值,如下所示:
# define the hash...
my %hash = (
foo => 1,
bar => 2,
baz => 3,
);
# change foo, bar, and baz to 4, 5, and 6 respectively
@hash{ 'foo', 'bar', 'baz' } = ( 4, 5, 6 );
在PHP中是否有类似的方法?事实上,是否存在一种获取关联数组片段的方法?