我有两个数组,第一个是第二个的排序版本(由用户排序),但第二个可以比第一个短或长。例如:$books_sorted = array( 0 => array( "title" => "In Search of Lost Time" ), 1 => array( "title" => "Don Quixote" ), 2 => array( "title" => "The Great Gatsby" ));$books_available = array( 0 => array( "title" => "Moby Dick" ), 1 => array( "title" => "In Search of Lost Time" ), 2 => array( "title" => "The Great Gatsby" ), 3 => array( "title" => "War and Peace" ));我需要第三个数组,它尊重用户设置的顺序,但从第二个数组中删除丢失的书籍,并在其末尾添加第二个数组中的所有新书籍。埃斯。// "Don Quixote" is not available anymore -> needs to be removed// "War and Peace" and "Moby Dick" are available -> need to be added both at the end$books_third_array = array( 0 => array( "title" => "In Search of Lost Time" ), 1 => array( "title" => "The Great Gatsby" ), 2 => array( "title" => "Moby Dick" ), 3 => array( "title" => "War and Peace" ) );我只放了“title”键,因为还有其他键,但我认为它们对这个例子没有用。任何帮助表示赞赏,谢谢。
2 回答
- 2 回答
- 0 关注
- 115 浏览
添加回答
举报
0/150
提交
取消