#35036 [NEW]: concatenate a string to each element of an array

From: Date: Mon, 31 Oct 2005 15:10:47 +0000
Subject: #35036 [NEW]: concatenate a string to each element of an array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-87263@lists.php.net to get a copy of this message
From: thomas dot hebinck at digionline dot de Operating system: Linux PHP version: 5.0.5 PHP Bug Type: Feature/Change Request Bug description: concatenate a string to each element of an array 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: -------------- ;-) -- Edit bug report at http://bugs.php.net/?id=35036&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35036&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35036&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35036&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=35036&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35036&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35036&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35036&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35036&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35036&r=support Expected behavior: http://bugs.php.net/fix.php?id=35036&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35036&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35036&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35036&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35036&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35036&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35036&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35036&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35036&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35036&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35036&r=mysqlcfg

« previous php.bugs (#87263) next »