Which is better?

@noeldemartin I would use the php.net/manual/en/datetime.sub

Within a loop subtracting 1 month each time and adding the result to an array.

@panigrc I also thought of something similar after posting this :D

I'm still not sure which one I prefer though. This one may be easier to understand, but the performance is not as good. Of course, that depends on whether performance is important or not, the context of the project where this is being developed, etc.

I was vague on purpose to see how people react.

Sign in to participate in the conversation
Noel's Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!