Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8943605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:49:00+00:00 2026-06-15T11:49:00+00:00

I want to check a value in an array. If its not there it

  • 0

I want to check a value in an array. If its not there it gets pushed to a new array. If the value is already there then its not added to the new value.
But with my code the checking of the value is not working.

Its still adding the array if the specific value is present.

I got this code:

foreach($user_movie_info['data'] as $movie) {

            similar_text($movie_facebook_page['genre'], $movie['genre'], $percent);

            if ($percent > 30) {
                echo $movie_facebook_page['genre']. "" ."</br>";
                echo $movie['genre']. "" ."</br>";
                echo $percent. "" ."</br>";
                echo "match! </br></br>";

                // add all movie information to matched array, only if its not already present
                if (!in_array($movie_facebook_page['name'], $matched_movies_array)) {

                    array_push($matched_movies_array, $movie_facebook_page);
                }




        } //foreach 

If i print out the $matched_movies_array i got one array 2 times in it:

Array
(
    [0] => Array
        (
            [about] => In theaters January 4th 2013 www.TexasChainsaw3D.com
            [can_post] => 1
            [description] => Lionsgate’s TEXAS CHAINSAW 3D continues the legendary story of the homicidal Sawyer family, picking up where Tobe Hooper’s 1974 horror classic left off in Newt, Texas, where for decades people went missing without a trace.  The townspeople long suspected the Sawyer family, owners of a local barbeque pit, were somehow responsible.  Their suspicions were finally confirmed one hot summer day when a young woman escaped the Sawyer house following the brutal murders of her four friends.  Word around the small town quickly spread, and a vigilante mob of enraged locals surrounded the Sawyer stronghold, burning it to the ground and killing every last member of the family – or so they thought. 

Decades later and hundreds of miles away from the original massacre, a young woman named Heather learns that she has inherited a Texas estate from a grandmother she never knew she had.  After embarking on a road trip with friends to uncover her roots, she finds she is the sole owner of a lavish, isolated Victorian mansion. But her newfound wealth comes at a price as she stumbles upon a horror that awaits her in the mansion’s dank cellars…

With gruesome surprises in store for a whole new generation, TEXAS CHAINSAW 3D stars Alexandra Daddario, Dan Yeager, Tremaine ‘Trey Songz’ Neverson, Scott Eastwood, Tania Raymonde, Shaun Sipos, Keram Malicki-Sanchez, James MacDonald, Thom Barry, Paul Rae and Richard Riehle, along with special appearances from four beloved cast members from previous installments of the franchise: Gunnar Hansen (the original Leatherface), Marilyn Burns, John Dugan and Bill Moseley. The film is directed by John Luessenhop (TAKERS), from a screenplay by Adam Marcus & Debra Sullivan and Kirsten Elms, based on a story by Stephen Susco and Adam Marcus & Debra Sullivan and based on characters created by Kim Henkel and Tobe Hooper, and produced by Carl Mazzocone. Lionsgate presents a  production and Main Line Pictures production.

            [directed_by] => John Luessenhop 
            [genre] => Horror
            [is_published] => 1
            [produced_by] => Millennium Films
            [release_date] => January 4th 2012
            [screenplay_by] => Adam Marcus & Debra Sullivan and Kirsten Elms
            [starring] => Alexandra Daddario, Dan Yeager, Tremaine ‘Trey Songz’ Neverson, Scott Eastwood, Tania Raymonde, Shaun Sipos, Keram Malicki-Sanchez, James MacDonald, Thom Barry, Paul Rae and Richard Riehle
            [studio] => Lionsgate
            [talking_about_count] => 62964
            [username] => TexasChainsaw3D
            [website] => www.texaschainsaw3d.com, twitter.com/lionsgatehorror, http://pinterest.com/lionsgatemovies/texas-chainsaw-3d, https://plus.google.com/u/0/+LionsgateMovies, http://instagr.am/p/Qpm0JMPtDr/
            [were_here_count] => 0
            [written_by] => based on a story by Stephen Susco and Adam Marcus & Debra Sullivan
            [category] => Movie
            [id] => 323192834416509
            [name] => Texas Chainsaw 3D
            [link] => http://www.facebook.com/TexasChainsaw3D
            [likes] => 367992
            [cover] => Array
                (
                    [cover_id] => 4.14284428641E+14
                    [source] => http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash3/s720x720/530974_414284428640682_1806025466_n.png
                    [offset_y] => 0
                )

        )

    [1] => Array
        (
            [about] => The official Facebook Page for The Shining |  All work and no play makes Jack a dull boy.
            [awards] => (1981) Saturn Award, Best Supporting Actor, Scatman Crothers
            [can_post] => 1
            [description] => Get The Shining at the WB Shop: http://bit.ly/shiningdvd
            [directed_by] => Stanley Kubrick 
            [genre] => Horror, Suspense/Thriller 
            [is_published] => 1
            [plot_outline] => All work and no play makes Academy Award-winner Jack Nicholson ("As Good As It Gets," "Batman"), the caretaker of an isolated resort, go way off the deep end, terrorizing his young son and wife Shelley Duvall ("Roxanne"). Master filmmaker Stanley Kubrick's ("Full Metal Jacket," "2001: A Space Odyssey") visually haunting chiller, based on the bestseller by master-of-suspense Stephen King ("The Stand," "Carrie," "The Shawshank Redemption"), is an undeniable contemporary classic. Newsweek Magazine calls this "the first epic horror film," full of indelible images, and a signature role for Nicholson whose character was recently selected by AFI for its' 50 Greatest Villains.

            [produced_by] => Jan Harlan, Stanley Kubrick
            [release_date] => 5/23/80
            [screenplay_by] => Stephen King, Diane Johnson  
            [starring] => Jack Nicholson, Shelley Duvall, Danny Lloyd, Scatman Crothers 
            [studio] => Warner Bros.
            [talking_about_count] => 5594
            [username] => KubrickShining
            [website] => http://bit.ly/shiningdvd
            [were_here_count] => 0
            [written_by] => Stephen King
            [category] => Movie
            [id] => 135347089926692
            [name] => The Shining
            [link] => http://www.facebook.com/KubrickShining
            [likes] => 832526
            [cover] => Array
                (
                    [cover_id] => 2.24275514367E+14
                    [source] => http://sphotos-f.ak.fbcdn.net/hphotos-ak-ash4/320182_224275514367182_46004854_n.jpg
                    [offset_y] => 85
                )

        )

    [2] => Array
        (
            [about] => The official Facebook Page for The Shining |  All work and no play makes Jack a dull boy.
            [awards] => (1981) Saturn Award, Best Supporting Actor, Scatman Crothers
            [can_post] => 1
            [description] => Get The Shining at the WB Shop: http://bit.ly/shiningdvd
            [directed_by] => Stanley Kubrick 
            [genre] => Horror, Suspense/Thriller 
            [is_published] => 1
            [plot_outline] => All work and no play makes Academy Award-winner Jack Nicholson ("As Good As It Gets," "Batman"), the caretaker of an isolated resort, go way off the deep end, terrorizing his young son and wife Shelley Duvall ("Roxanne"). Master filmmaker Stanley Kubrick's ("Full Metal Jacket," "2001: A Space Odyssey") visually haunting chiller, based on the bestseller by master-of-suspense Stephen King ("The Stand," "Carrie," "The Shawshank Redemption"), is an undeniable contemporary classic. Newsweek Magazine calls this "the first epic horror film," full of indelible images, and a signature role for Nicholson whose character was recently selected by AFI for its' 50 Greatest Villains.

            [produced_by] => Jan Harlan, Stanley Kubrick
            [release_date] => 5/23/80
            [screenplay_by] => Stephen King, Diane Johnson  
            [starring] => Jack Nicholson, Shelley Duvall, Danny Lloyd, Scatman Crothers 
            [studio] => Warner Bros.
            [talking_about_count] => 5594
            [username] => KubrickShining
            [website] => http://bit.ly/shiningdvd
            [were_here_count] => 0
            [written_by] => Stephen King
            [category] => Movie
            [id] => 135347089926692
            [name] => The Shining
            [link] => http://www.facebook.com/KubrickShining
            [likes] => 832526
            [cover] => Array
                (
                    [cover_id] => 2.24275514367E+14
                    [source] => http://sphotos-f.ak.fbcdn.net/hphotos-ak-ash4/320182_224275514367182_46004854_n.jpg
                    [offset_y] => 85
                )

        )

)

I get this info from the open graph api from Facebook.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:49:02+00:00Added an answer on June 15, 2026 at 11:49 am

    $matched_movies_array does not contain the movie names. So in_array will never pass.

    Try something like:

    $movieIds = array();
    foreach($user_movie_info['data'] as $movie) {
    
            similar_text($movie_facebook_page['genre'], $movie['genre'], $percent);
    
            if ($percent > 30) {
                echo $movie_facebook_page['genre']. "" ."</br>";
                echo $movie['genre']. "" ."</br>";
                echo $percent. "" ."</br>";
                echo "match! </br></br>";
    
                // add all movie information to matched array, only if its not already present
                if (!in_array($movie_facebook_page['id'], $movieIds)) {
                    $movieIds[] = $movie_facebook_page['id'];
                    array_push($matched_movies_array, $movie_facebook_page);
                }
    
    
    
    
        } //foreach 
    

    Or maybe even better:

                $id = $movie_facebook_page['id'];
                if (!isset($matched_movies_array[$id])) {
                    $matched_movies_array[$id] = $movie_facebook_page;
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to check value in array if exits then show Exits otherwise show
I want to check if a value exists in an array made from a
I want to check a Column value when update.If its match insert into another
How do I check if my value is a integer or not? I want
i want to get the value of this td my code function check() {
i want to check users' input value when he input his name, if his
I don't want check if an item with a value exists in the arraylist,
I want to check if a Dom has class value attached to it.. Since
I want to check if a floating point value is nearly a multiple of
I want to check in zend, whether a posted form value 'name' contains a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.