PHP ArrayList implementation inspired by Java.