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

  • Home
  • SEARCH
  • 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 8853693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:42:51+00:00 2026-06-14T13:42:51+00:00

First time trying to find something in an array using an array as both

  • 0

First time trying to find something in an array using an array as both a needle and a haystack. So, example of 2 arrays:

My Dynamically formed array:

Array ( 
    [0] => 
    [1] => zpp 
    [2] => enroll 
) 

My Static comparison array:

Array ( 
    [0] => enroll 
) 

And my in_array() if statement:

if (in_array($location_split, $this->_acceptable)) {
   echo 'found';
}
$location_split; // is my dynamic
$this->_acceptable // is my static

But from this found is not printed out, as I’d expect it to be? What exactly am I failing on here?

  • 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-14T13:42:52+00:00Added an answer on June 14, 2026 at 1:42 pm

    If i’m understanding you right, you want to see whether the first array’s entries are present in the second array.

    You might look at array_intersect, which would return you an array of stuff that’s present in all the arrays you pass it.

    $common = array_intersect($this->_acceptable, $location_split);
    if (count($common)) {
        echo 'found';
    }
    

    If the count of that array is at least 1, then there’s at least one element in common. If it’s equal to your dynamic array’s length, and the array’s values are distinct, then they’re all in there.

    And, of course, the array will be able to tell you which values matched.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First time using rails, I'm trying to create a download link to get something
First time working with JSON in Rails and trying to figure out something which
I am trying to find out if its the users first time on my
I am trying Guava for the first time and I find it really awesome.
First time trying to deal with users logging in with ASP.net and haven't had
This is my first time trying to set up a database. My intent is
this is my first time trying to use document classes in AS3 and im
It's my first time trying to make anything really interesting in C# and I
Hey everyone, my first time trying to draw a multi-color gradient in actionscript 3.
I'm exploring Rails for the first time and trying to add some fairly straightforward

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.