Modifying array

A

Anonymous

Guest
I have an array with strings in it
now I want to update the array with attaching single quotes to it

eg
$ar[0] = val1;
$ar[1] = val1;

change to
$ar[0] = 'val1';
$ar[1] = 'val1';

I don't remember what array function can help change the contents of the array! :?: :!:
 
found It sorry to disturb you all
if you know any other soln :idea:

Code:
//function for adding quotes
	function add_quotes(&$q1, $qk)
	{
		$q1 = "'" . $q1 . "'";
		$keyword[$qk] = $q1;

	}

	if(array_walk($keyword, 'add_quotes')) {
		//echo 'succ';
	}
 
sigix said:
both are correct

What do you mean both? It's just one piece of code. You need the whole thing to do it to the whole array. Maybe you should read the documentation for array_walk().
 
Back
Top