以MD5多维数组PHP最好的方法? [英] PHP best way to MD5 multi-dimensional array?

查看:156
本文介绍了以MD5多维数组PHP最好的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么是生成多维数组的MD5(或任何其他哈希值)的最好方法?

我可以轻松地编写一个循环将通过阵列中的每个层次遍历,串联每个值转换成字符串,并简单地对字符串进行MD5。

不过,这似乎繁琐的最好的,我想知道是否有这将需要一个多维数组,哈希呢?一个时髦的功能

感谢您的时间。


解决方案

  MD5(连载($阵列));

i was wondering what is the best way to generate an MD5 (or any other hash) of a multi-dimensional array?

I could easily write a loop which would traverse through each level of the array, concatenating each value into a string, and simply performing the MD5 on the string.

However, this seems cumbersome at best and i wondered if there was a funky function which would take a multi-dimensional array, and hash it?

Thanks for your time.

解决方案

md5(serialize($array));

这篇关于以MD5多维数组PHP最好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆