c++ - how to add an static array in php class with php-cpp -


i want add static member below

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

this 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 set php::array or php::value 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 set array or php::value", php::public | php::static); 

zend api not support — default property values cannot 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


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -