Hashing an entire PHP array into a unique value [duplicate]

Use md5(serialize()) instead of print_r().

print_r()‘s purpose is primarily as a debugging function and is formatted for plain text display, whereas serialize() encodes an array or object representation as a compact text string for persistance in database or session storage (or any other persistance mechanism).

Leave a Comment