COMMUNITY

How to convert native php array to haxe array?

I’m trying to create an array, filled with zeroes of a particular size.
Doing like it’s defined in Bytes.alloc:

  var a = new Array();
  for (i in 0...length)
  	a.push(0);
  return new Bytes(length, a);

Is too slow. I do

php.Global.array_fill(0, length, 0);

but this array doesn’t have “length” and other haxe Array functionality. Is there any way to convert it from Native to Haxe? Thank you

var hxArray = php.Lib.toHaxeArray(nativeArray);
1 Like