php - How would you compare the names in a list to ones in an Array? -


I have a list of movies and I want to compare to the array of movies from the Facebook graph API. "Name": "The Flow Bible", "Category": "Movie", "Id": "227431881228", "Created_time": "2011-02-27 T 21: 41: 04 + 0000 "}, {" name ":" shooter "," category ":" movie "," id ":" 10 9 671005718938 "," created_time ":" 2011-02-16T0 9: 18: 29 + 0000 "} ...

The list which I need to compare is very large, but these are some of the things:

.

  if ($ movies-> data-> name == 'movie title list ') {Echo if In ("Movie title list", $ A)) "echo" ("movie title list", $ a)) "  

" You love the same movie ";}

Any ideas will help me

thanks

$ large_data = '{"data": [{" Name ":" Flow Bible "," Category ":" Movie "," Id ":" 227431881228 "," Time Created ":" 2011-02-27T 21: 41: 04 + 0000 "}, {" Name ":" Shooter "," category ":" movie "," id ":" 10 9 671005718938 "," created time ":" 2011-02-16T0 9: 18: 29 + 0000 "}]} '; $ Json_to_array = json_decode ($ large_data, true); Var_dump (json_decode ($ big_data, true)); // Now you will be able to compare two array echo print_r ($ json_to_array, true);

Edit:

Was posted on @Eric improvements

  $ large_data = '{"data": [ "" "" "" "" "" "" "" "" "" "" "" "", "Category": "movie", "id": "10 9 671005718938", "created time": "2011-02-16T0 9: 18: 29 + 0000"}]} '$ Movie_list = json_decode ($ large_data, true); $ MovieNames = array (); Foreign currency ($ movie_list as $ movies) {foreign Movie ($ movie as movie $) {$ movieNames [] = $ movie ['name'];}} $ MyMovies = array ('wall street', 'shooter', 'young gun', 'due date') ; $ Normal_movies = array-mark ($ movie name, $ myMovies); Foreign currency ($ common_movie $ as common_mevy) {echo "We like the same movie". $ Common_me. "& Lt; Br / & gt; \ N ";}    

Comments