Category: array

Creating Strictly Typed Arrays and Collections in PHP

One of the language features announced back in PHP 5.6 was the addition of the ... token to denote that a function or method accepts a variable length of arguments. Something I rarely see mentioned is that it’s possible to combine this feature with type hints to essentially create typed arrays. For example, we could ...

Sourcehunt September – Hacktoberfest Edition

It’s that time of year again – DigitalOcean’s Hacktoberfest is starting! It’s a month-long open source effort when people are encouraged to contribute to various open source projects (not their own!). Anyone who opens 4 pull requests (even documentation fixes count!) gets a T-shirt at the end of...

Quick Tip: How to Create and Manipulate Arrays in JavaScript

This article was peer reviewed by Chris Perry and Marcello La Rocca. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be! The length property of Array objects is one that many who are relatively new to JavaScript do not understand. Many mistakenly believe that the length te...