我有一个文本文件,其中包含一些我想放入2D数组的东西.该文本文件包含相等长度的句子.如何将每个单词放入数组?
文本文件的示例是 -
这是stackoverflow
我是用户
该文件每行包含3个单词
This - at [0][0] position
is - at [0][1] position
stackoverflow - at [0][2] position
I - at [1][0] position
am - at [1][1] position
user - at [1][2] position
Run Code Online (Sandbox Code Playgroud)
我做了这样的事情,但似乎没有成功.
$word_count = $word_length = 0;
if ($fh = fopen('array.txt','r')) {
while (! feof($fh)) {
if ($s = fgets($fh,1048576)) {
$words = preg_split('/\s+/',$s,-1,PREG_SPLIT_NO_EMPTY);
foreach ($words as $word) {
$word_count++;
$word_length += strlen($word);
$array = array();
for($i=$a;$i<($word_count/4);$i++)
{
for($j=$b;$j<4;$j++)
{
$array[$i][$j]=$words[$j];
}
}
}
} …
Run Code Online (Sandbox Code Playgroud) 哪个是PHP中最安全的密码哈希算法?
速度是无关紧要的,因为我在一段固定的时间内迭代哈希(而不是固定的迭代次数).我感兴趣的是数学实力.
我的直觉告诉我它是漩涡,是最大和最慢的一群.那还是SHA-512.哪位专家推荐?
有没有其他算法提供超过512位的哈希?
php ×2
algorithm ×1
arrays ×1
encryption ×1
hash ×1
html ×1
javascript ×1
parsing ×1
security ×1
web-worker ×1