Applying a function all values in an array

gameover32

New Member
$jobs is an array retrieved from a DB query. \[code\]print_r($jobs)\[/code\] shows:\[code\]Array( [ID] => 131 [Title] => -bla- [Baseline] => lorem ipsum ... [Description] => <ul><li>list 1</li><li>list 2</li></ul> [EventID] => 1008)Array( [ID] => 132 [Title] => -bla 2- [Baseline] => lorem ipsum lorem ipsum... [Description] => <ul><li>list 1</li><li>list 2</li></ul> [EventID] => 1009)\[/code\]etc ...Id like to run utf8_encode() on all values of these arrays. I'm not sure if I should use array_map, array_walk_recursive ? The output should not alter the names of the array keys so that I don't need to change anything in my template, so\[code\]<h1><?=$j['title']?></h1>\[/code\]should still work, albeit utf8 encoded.EDIT: I'm trying the following, no luck\[code\]function fix_chars($key, $value){ return utf8_encode($value);}array_walk_recursive($jobs, 'fix_chars');\[/code\]
 
Back
Top