I'm trying to find difference between these two arrays by doing:
$linkedAritclesToBeRemoved = array_diff($oldLinkedArticleIds, $linkedArticlesIds);
$linkedArticlesToBeAdded = array_diff($linkedArticlesIds, $oldLinkedArticleIds);
The above code throws a warning Notice: Array to string conversion, This warning is because my one array is single array and the other is multidimensional. So i want to remove this warning message and i want the arrays to be compatible for array_diff function! How can I do it?
Note: I know it's a notice but i want to remove this.
New Array (linkedArticlesIds):
array(5) {
[0]=>
string(1) "6"
[1]=>
string(1) "2"
[2]=>
string(1) "1"
[3]=>
string(1) "7"
[4]=>
string(1) "8"
}
Old Array( $oldLinkedArticleIds ):
array(3) {
[0]=>
array(6) {
["id"]=>
int(30)
["article_id"]=>
int(1)
["linked_article_id"]=>
int(6)
["order_by"]=>
NULL
["created_at"]=>
string(19) "2019-01-03 00:00:00"
["updated_at"]=>
string(19) "2019-01-03 00:00:00"
}
[1]=>
array(6) {
["id"]=>
int(31)
["article_id"]=>
int(1)
["linked_article_id"]=>
int(2)
["order_by"]=>
NULL
["created_at"]=>
string(19) "2019-01-03 00:00:00"
["updated_at"]=>
string(19) "2019-01-03 00:00:00"
}
[2]=>
array(6) {
["id"]=>
int(32)
["article_id"]=>
int(1)
["linked_article_id"]=>
int(1)
["order_by"]=>
NULL
["created_at"]=>
string(19) "2019-01-03 00:00:00"
["updated_at"]=>
string(19) "2019-01-03 00:00:00"
}
}