Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGeorgina Pacey
4,139 PointsPreview is blank. array_walk
I am sure it's something obvious, but why does the preview come up blank?
<?php
$names = array(
'Mike' => 'Frog',
'Chris' => 'Teacher',
'Hampton' => 'Teacher'
);
function print_info($value, $key){
echo "$key is a $value.</br>";
}
array_walk($names, 'print info');
1 Answer
thomascawthorn
22,986 PointsHmm, it looks like your function name is 'print_info', but you've called 'print info'.
Try adding an underscore like this:
<?php
array_walk($names, 'print_info');