Created
April 3, 2015 09:22
-
-
Save msg7086/01761d72e1d8c2cf12ae to your computer and use it in GitHub Desktop.
v2ex-181180
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$hash = []; | |
foreach($rows as &$row) { | |
$key = $row['period'] << 32 | $row['price']; | |
if (isset($hash[$key])) | |
$hash[$key]['num'] += $row['num']; | |
else { | |
unset($row['id']); | |
$hash[$key] = $row; | |
} | |
} | |
print_r($hash); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment