[thelist] php array_walk help?

Dave Preston caffiend at simianbrotherhood.org
Thu Dec 13 12:16:21 CST 2001


I've got php-4.0.6 running on apache 1.3.22 and linux and can't get this
thing to work the way I'd like it to for the life of me.

Rather than returning the string I'm expecting from the function,
array_walk just seems to be evaluating true (it returns '1'). If I put
in 

'print $link' instead of 'return $link' it shows that $link does have
the expected data, what am I missing?

Thanks,

-d

my function:


function shows_row($ar, $class_bnd='band', $class_lnk='band') {
    if(is_array($ar)){
        reset($ar);
        $band = $ar['name'];
        if($ar['url'] != '') {
            $link = '<a class="' . $class_link . '" href="' . $ar['url']
. '">' . $band . '</a>
';
        } else {
            $link = '<div class="' . $class_bnd . '">' . $band . '</div>
';
        }
        return $link;
    } else {
        return 0;
    }
}


and from the page in question:


    $page .= array_walk($band_data, 'shows_row');

	print $page;





More information about the thelist mailing list