0

I want to add a static member like below

class BaseYii{
    public static $map = [1,2,3]//sutff
}

this is my c++ code ,

class BaseYii : public Php::Base {
public:
Php::Array  hehe;

BaseYii() = default;

/**
 *  c++ destructor
 */
virtual ~BaseYii() = default;

void __construct() {
    Php::Value self(this);
    Php::Array x{123, "adf"};
    self["fff"] = x;
}

void getServer() {
    Php::call("var_dump", Php::SERVER);
}
};

register extension, how to set a Php::Array or Php::value to this property

Php::Class<BaseYii> baseYii("BaseYii");

Php::Class<Yii> Yii("Yii");
static std::map<int, int> map;
map[1] = 1;
baseYii.property("classMap", "here ,i want to set a Array or Php::value", Php::Public | Php::Static);
Big Pig
  • 1
  • 1

1 Answers1

0

Zend API does not support this — default property values cannot be arrays, objects or resources.

http://lxr.php.net/source/xref/PHP-7.0/Zend/zend_API.c

https://github.com/CopernicaMarketingSoftware/PHP-CPP/issues/277

Big Pig
  • 1
  • 1