array_map 并将字符串附加到数组的元素
我有一个像这样的数组:
$a = array('aa', 'bb', 'cc', 'dd');
我想在数组所有元素的开头添加“rq”字符串。是否可以通过在此数组上调用 array_map() 来完成此操作?
I have an array like this:
$a = array('aa', 'bb', 'cc', 'dd');
I want to add the 'rq' string at the beginning of all the elements of the array. Is it possible to do it by calling array_map() on this array?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另请参阅此示例。
Also see this example.
你可以这样:
You can have it like this: