2つの配列このように、この場合はarray_replace_recursive()は機能しません。PHPで選択されたクエリから2つの配列がマージされました:UPDATE
Array
(
[0] => stdClass Object
(
[Author] => 1
[totalComments] => 5
[commentsPoints] => 900
[commentDateDiffpoints] => 460
)
[1] => stdClass Object
(
[Author] => 2
[totalComments] => 4
[commentsPoints] => 720
[commentDateDiffpoints] => 24
)
[2] => stdClass Object
(
[Author] => 3
[totalComments] => 4
[commentsPoints] => 720
[commentDateDiffpoints] => 24
)
[3] => stdClass Object
(
[Author] => 18
[totalComments] => 4
[commentsPoints] => 720
[commentDateDiffpoints] => 24
)
)
と
Array
(
[0] => stdClass Object
(
[Author] => 1
[totalLikesGiven] => 5
[likesGivenOnTopicPoints] => 36
[likesGivenOnReplyPoints] => 108
[likesGivenOnBlogPoints] => 36
[DateDiffTopicpoints] => 1
[DateDiffReplypoints] => 3
[DateDiffBlogpoints] => 1
)
[1] => stdClass Object
(
[Author] => 3
[totalLikesGiven] => 1
[likesGivenOnTopicPoints] => 0
[likesGivenOnReplyPoints] => 0
[likesGivenOnBlogPoints] => 36
[DateDiffTopicpoints] => 0
[DateDiffReplypoints] => 0
[DateDiffBlogpoints] => 1
)
)
私はPHPで同じことを行うことができますどのように助けてください、この
Array
(
[0] => stdClass Object
(
[Author] => 1
[totalComments] => 5
[commentsPoints] => 900
[commentDateDiffpoints] => 460
[totalLikesGiven] => 5
[likesGivenOnTopicPoints] => 36
[likesGivenOnReplyPoints] => 108
[likesGivenOnBlogPoints] => 36
[DateDiffTopicpoints] => 1
[DateDiffReplypoints] => 3
[DateDiffBlogpoints] => 1
)
[1] => stdClass Object
(
[Author] => 2
[totalComments] => 4
[commentsPoints] => 720
[commentDateDiffpoints] => 24
)
[2] => stdClass Object
(
[Author] => 3
[totalComments] => 4
[commentsPoints] => 720
[commentDateDiffpoints] => 24
[totalLikesGiven] => 1
[likesGivenOnTopicPoints] => 0
[likesGivenOnReplyPoints] => 0
[likesGivenOnBlogPoints] => 36
[DateDiffTopicpoints] => 0
[DateDiffReplypoints] => 0
[DateDiffBlogpoints] => 1
)
[3] => stdClass Object
(
[Author] => 18
[totalComments] => 4
[commentsPoints] => 720
[commentDateDiffpoints] => 24
)
)
LIKE結果が好きです。
アレイ内のオブジェクトのヒント。ほとんどの場合、データベースの主キーが配列のキーとして使用されます。 あなたのオブジェクトをより迅速に見つけることができるように –