|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-31 16:19 UTC] amt@php.net
[2005-10-31 16:20 UTC] amt@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
Description: ------------ I'd like to have a fast function, which concatenates a string to each element of an array. Reproduce code: --------------- array array_concatenate ( array array, string string [, bool to_end=true]) Something like this as a php function: $arr=array(1,2,3,4,5,6,7,8,9,0); $str=' test'; array_walk($arr,create_function('&$elem','$elem .= "' . $str . '";')); Expected result: ---------------- array ( 0 => '1 test', 1 => '2 test', 2 => '3 test', 3 => '4 test', 4 => '5 test', 5 => '6 test', 6 => '7 test', 7 => '8 test', 8 => '9 test', 9 => '0 test', ) Actual result: -------------- ;-)