-3

Below is array_walk function which is throwing error on php 5.2. I have 5.2 version on stage and 5.3 on local and dev. Code works fine on local and dev php version.

foreach($favTracks as $track_id) {
array_walk($tracks, function ($t, $k) use ($track_id, &$return) {    
    if($t['track_code'] == $track_id) {
        $trackDetails = variable_get('drf_admin_top_track_'. $k . '_news_list', array());
        $return[$track_id]  = array('articles' => 
        get_fav_details($trackDetails), 
        'trackName' => isset($t['title']) ? $t['title'] : "" );
    }        
});    
}
Barmar
  • 741,623
  • 53
  • 500
  • 612
Kalashir
  • 1,099
  • 4
  • 15
  • 38

1 Answers1

0

I have solved the issue by doing below code.

function getTopTrackWalk($t, $k, $trackArr) {    
  if($t['track_code'] == $trackArr[0]) {
  $trackDetails = variable_get('drf_admin_top_track_'. $k . '_news_list', array());
  $trackArr[1][$trackArr[0]]  = array('articles' => 
  get_fav_details($trackDetails), 
'trackName' => isset($t['title']) ? $t['title'] : "" );
}           
}
array_walk($tracks, "getTopTrackWalk", array($track_id, &$return));  
Kalashir
  • 1,099
  • 4
  • 15
  • 38