Results 1 to 4 of 4
September 11th, 2005, 04:44 AM #1
How to append a string into an array in PHP?
- Join Date
- June 8th, 2005
How do I append a string, ex. a delimiter '/' into an array?
$pattern = '/' . $keywords . '/';
$keywords is an array but the $pattern won't turn into an array.
September 11th, 2005, 06:59 AM #2
try$pattern = array('/','$keywords','/');"Effective people are not problem-minded; they're opportunity minded. They feed opportunities and starve problems."
September 11th, 2005, 07:14 AM #3
- Join Date
- January 18th, 2005
array_walk($keywords, create_function('&$v,$k', '$v = "/" . $v . "/";'));
$pattern = $keywords;
Lead, Follow or Get Out of the Way!
September 11th, 2005, 08:00 AM #4
Well, if you want to do the operation on every item of the array, then do what Buddha said.
This should take ("a", "b", "c") and give you ("/a/", "/b/", "/c/").
If you actually mean that you want to put your delimiter at the beginning and end of your array, then try something like this:
$newarray = array_merge((array) "/", $oldarray, (array) "/");
-John.There's a reason army's wear uniforms even though it makes them easier to spot. Sometimes that's what you want. Uniforms suggest organization, power, and numbers. These, in turn, inspire fear. And, as any good operative knows, there is no more effective weapon than fear.
Hosting Comparison - HostScope - jrrl.com
By kylekangaroo2011 in forum Programming / Datafeeds / ToolsReplies: 1Last Post: May 30th, 2012, 04:54 PM
By Tami in forum Google Affiliate Network - GANReplies: 0Last Post: May 20th, 2007, 08:00 AM
By grafx77 in forum Programming / Datafeeds / ToolsReplies: 0Last Post: June 7th, 2006, 01:41 AM