1

I get error

PHP Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’ in site.com/app/code/community/EbayEnterprise/Affiliate/Helper/Data.php on line 41

from Data.php

37 public function getAllProgramIds() 
 38 { 
 39 $config = Mage::helper(’eems_affiliate/config’); 
40 return array_unique(array_filter(array_map( 
 41 function ($website) use ($config) { 
 42 return $config->getProgramId($website->getDefaultStore()); 
 43 }, 
 44 Mage::app()->getWebsites() 
 45 ))); 
 46 } 

this code for php 5.3 - but I use only php 5.2.17, and can not apdate - please help change this line 41 - that can be work on php 5.2.17

4

First: you don't want to do this. You want to upgrade your PHP. 5.2 is so extremely outdated at this point you're a sitting duck for every script kid out there. The reason this code doesn't work is because PHP 5.2 doesn't support closures.

public function getAllProgramIds() 
{ 
    $config = Mage::helper(’eems_affiliate/config’); 

    $websites = Mage::app()->getWebsites();

    $ids = array();
    foreach($websites as $website) {
        $ids[] = $config->getProgramId($website->getDefaultStore());
    }

    return array_unique($ids);
}

I think that does what you want.

Upgrade your PHP!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.