Actually this is not specific to PHP at all. Ruby just uses a different hashing algorithm so you need to set different keys to get these results.
This is a problem that hashtables have in general (unless they are randomized).
This is a problem that hashtables have in general (unless they are randomized).