PHP “&” operator

Those are references, and they are similar to “pointers” in C or C++.

More information is in the PHP manual.

In this case, since $db_hosts is empty, the construct $db_hosts[$db_item['hostid']] will create a new array with an empty item on the index of $db_item['hostid'] and return the item’s reference, making $db_host act as an ‘alias’ for whatever $db_hosts[$db_item['hostid']] is currently.

Leave a Reply

Your email address will not be published. Required fields are marked *