# TIP: "Add item to an Array" as an operator

**URL:** <https://forum.kirupa.com/t/tip-add-item-to-an-array-as-an-operator/323027>\
**Category:** programming\
**Created:** [June 14, 2011, 9:23am UTC](https://forum.kirupa.com/t/tip-add-item-to-an-array-as-an-operator/323027 "2011-06-14T09:23:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IQAndreas](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@IQAndreas](https://forum.kirupa.com/u/IQAndreas)\
**Post date:** [June 14, 2011, 9:23am UTC](https://forum.kirupa.com/t/tip-add-item-to-an-array-as-an-operator/323027/1 "2011-06-14T09:23:43Z")

</div>

In nearly every tutorial (including the php manual) you add items to the end of an Array by writing this:

```php
$array[] = $item;

```

Which is a tad odd, but I have just gotten used to it.

But today I stumbled across a peice of code where they fiddle a bit with the spaces to make that look like an operator!

```php
$array []= $item;

```

Which looks great and makes a tad more sense. 🙂
