In HACK array can be created using one of the following ways:
Untyped Array : array
Explicitly Typed Array with Integer key: array<Type>
Explicitly Typed Array with string or Integer key: array<int, Type> / array<string, Type>
Example:
<?hh
class MyClass {}
class MyArray {
  private array $arr1;//Array with Integer key
  private array $arr2;
//Array with string key
  public function __construct() { 
    $this->arr1 = array();
    $this->arr2 = array();
 }
}

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.