this post was submitted on 23 Oct 2023
562 points (96.2% liked)

Programmer Humor

32588 readers
1033 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] 2 points 1 year ago (1 children)

stdClass is for objects. I'm talking about maps. I guess you could use stdClass for maps too, but that feels weird.

[โ€“] xmunk 1 points 1 year ago

If you read the docs for json_decode, the default behavior is to operate with stdClass - I too prefer working with associative arrays because of their power but... that kind of just reinforces how useful they are. PHP can give you the full Java class system if you want.. it's just a pain and useless in most circumstances so we all just toss around associative arrays.