1

Fatal error: Access to undeclared static property: DTS\eBaySDK\Constants\GlobalIds::$stripped in /home/jimi13/public_html/dealpopup.com/ebayapi/finding/mine.php on line 334

$stripped = str_replace(' ', '', $country);
$stripped = preg_replace('/\s+/', '', $stripped);
echo $stripped;

need to take put stripped into this

$service = new Services\FindingService([
    'credentials' => $config['production']['credentials'],
    'globalId'    => Constants\GlobalIds::US
]);

need to put this in, but throws error

$service = new Services\FindingService([
    'credentials' => $config['production']['credentials'],
    'globalId'    => Constants\GlobalIds::$stripped
]);
Dave
  • 5,108
  • 16
  • 30
  • 40
Pete Dawg
  • 58
  • 5
  • Think it is https://stackoverflow.com/questions/7506530/accessing-a-class-constant-using-a-simple-variable-which-contains-the-name-of-th – Nigel Ren Oct 22 '19 at 17:50
  • Thanks for the help, I have not yet been able to send what I need. I am trying to send the variable $stripped in place of the US. How would I achieve that – Pete Dawg Oct 22 '19 at 21:07

1 Answers1

0

Here is a way you can access a constant variable in the class with namespace. If no namespace then you can remove the Constants namespace.

namespace Constants;

class Hello {
  const WORLD = 'Hello World';
}

$world = 'WORLD';
echo constant('Constants\Hello::' . $world);
blupointmedia
  • 564
  • 2
  • 10