News for hackers. Stuff that matters.
Re:Union Types have been accepted for PHP 8 by uryga on Saturday November 09, 2019 @08:50PM (#21495891)
i think that's just a matter of naming – afaik PHP "arrays" are what you'd call a map/dict/hash in other languages
Re:Union Types have been accepted for PHP 8 by capn_cabbage on Saturday November 09, 2019 @10:35PM (#21496234)
I believe it is just a naming issue. Not even sure that PHP devs have agreed on how to name the type. Internally, PHP calls them both arrays and hash tables if I understand correctly.

In Zend/zend_types.h[1] of PHP source:

    typedef struct _zend_array zend_array;
    typedef struct _zend_array HashTable;
    struct _zend_array {
        ...
    };
That being said AFAICT, HashTable and zend_array are used interchangeably throughout the source. I am not a C programmer, but I did write a couple of PHP extensions and that was my general understanding. Perhaps it is a compatibility issue or just used to abstract types differently in various areas of the C API.

Check out [2] for a deeper understanding of how arrays are handled internally in PHP.

[1]: https://github.com/php/php-src/blob/php-7.3.11/Zend/zend_typ...

[2]: https://nikic.github.io/2014/12/22/PHPs-new-hashtable-implem...