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 961561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:21:53+00:00 2026-05-16T01:21:53+00:00

There is a variable $list , which has some array. printr_r($list); Gives something like:

  • 0

There is a variable $list, which has some array.

printr_r($list);

Gives something like:

Array (
    [0] => stdClass Object (
        [ID] => 1
        [name] => Martha Dandridge
    )
    [1] => stdClass Object (
        [ID] => 35
        [name] => Abigail Smith
    )
    [2] => stdClass Object (
        [ID] => 153
        [name] => Julia Gardiner
    )
    [3] => stdClass Object (
        [ID] => 271
        [name] => Hillary Rodham
    )
    [4] => stdClass Object (
        [ID] => 124
        [name] => Nancy Davis
    )
)

We should check, if any entry of this array has wanted value in [name].

Like:

if($list has "Nancy Davis" or "Hillary Rodham" in [name] of some entry?) {
    return true;
} else {
    return false;
}

We have both “Nancy Davis” and “Hillary Rodham” in our array, so it should give true.

If we ask like this:

  if($list has "George Bush" or "Lou Henry" or "Helen Herron" in [name] of some entry?) { ... }

It should give false, because there aren’t such values in any name.

There can be any number of entries in array (I mean [0], [1] ... [any]), it should check [name] of each entry.

  • 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-05-16T01:21:54+00:00Added an answer on May 16, 2026 at 1:21 am
    $match = false;
    foreach($list as $value){
      if($value->name == "George Bush" || $value->name =="Lou Henry" || $value->name == "Helen Herron") {
        $match = true;
        break;
      }
    }
    
    if($match) {
      // do some if true
    } else {
      // do dome if false
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 496k
  • Answers 496k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use the :not() selector to exclude it, like… May 16, 2026 at 11:45 am
  • Editorial Team
    Editorial Team added an answer The standard jQuery style is to bind all your functions… May 16, 2026 at 11:45 am
  • Editorial Team
    Editorial Team added an answer These are all really subjective issues - people mostly disagree… May 16, 2026 at 11:45 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm doing a simple ajax query which retrieves a variable-length list of values as
There is a field on which some items are draggable: Here is a XAML
I have an initialization class that preloads content into a variable (probably a list
I currently have a log object I'd like to remove objects from, based on
If I have a variable in C# that needs to be checked to determine
So, the object model is rather complex and hierarchical. Grandfather accepts is created by
branch is of checkbox list type, but while looping through this it adds only
I have a table that currently is a long list of devices and information
My GWT module UI is only single button ( like AddThis/ShareThis Sharing Button ),
I'm trying to retrieve odd values in a List of strings and convert them

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.