this post was submitted on 14 Jul 2023
338 points (91.0% liked)

Programmer Humor

34912 readers
229 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 37 points 2 years ago (8 children)

Ever wondered about the array_fill function? It can be baffling. Try filling an array with a negative index:

array_fill(-5, 4, 'test');

Many languages would throw an error, but PHP? It’s perfectly fine with this and you get an array starting at index -5. It’s like PHP is the Wild West of array indexing!

[–] [email protected] 3 points 2 years ago

it was never an array to begin with!

load more comments (7 replies)