gevans Posted September 17, 2009 Share Posted September 17, 2009 Hey guys, This question isn't really how to do it, as I already have... but I didn't manage to do it the way I wanted to.... I have a 'breadcrumb' class that's main method gets passed an array of string. These strings are the different segments of the URI. The whole process is fairly simple, but at the very beginning I check to see if 'home' is in the array, and if so remove it. I'm actually happy with the way I'm currently doing this, but was curious about 'array_filter()'. If I user 'array_filer()' within a class what do I put in the callback place? I thought about doing this (though it didn't really make sense); <?php class Breadcrumb extends Model { function Breadcrumb() { parent::Model(); } function get(array $values) { var_dump($values); /*$i=0; $breadcrumb[$i]['title'] = 'home'; $breadcrumb[$i]['safe_title'] = 'home'; $i++;*/ $values = array_filter($values, "$this->breadcrumb->_filter_home"); var_dump($values); #return $breadcrumb; } function _filter_home($a) { return ($a === "home")? TRUE : FALSE; } } Was just wondering what you thought? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.