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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:34:16+00:00 2026-05-31T07:34:16+00:00

This is the $feed_content array Array ( [0] => Array ( [id] => 1

  • 0

This is the $feed_content array

Array
    (
        [0] => Array
            (
                [id] => 1
                [link] => http://www.dust-off.com/10-tips-on-how-to-love-your-portable-screens-keeping-them-healthy
    )
        [1] => Array
            (
                [id] => 2
                [link] => http://www.dust-off.com/are-you-the-resident-germaphobe-in-your-office
            )
     )

—-Another array———-
This is the $arrFeeds array

Array
(
    [0] => Array
        (
            [title] => 10 Tips on How to Love Your Portable Screens (Keeping them Healthy)
            [link] => http://www.dust-off.com/10-tips-on-how-to-love-your-portable-screens-keeping-them-healthy
  )
   [1] => Array
        (
            [title] => Are You the Resident Germaphobe in Your Office?
            [link] => http://www.dust-off.com/are-you-the-resident-germaphobe-in-your-office
        )


)

Here’s my code:

foreach( $arrFeeds as $key2 => $value2 )
    {
        $feed_content = $feed->get_feed_content( $value['id'] );

        if( !in_array( $value2['link'], $feed_content ) )
        {
            echo "not match!";
        }
    }

Question:

Why is it that the code always enters into the if statement even if $feed_content link value has the value of the $arrFeeds link?
My expected result should be that my code would tell me if the $feed_content link value is not in the $arrFeeds.
By the way, the $feed_content code returns an array that I specified above.
What should be the problem with this one. Thanks in advance! 🙂

  • 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-31T07:34:17+00:00Added an answer on May 31, 2026 at 7:34 am

    that’s because the elements of your array called $feed_content are associative arrays also (with the id and link keys)

    you are checking if the link (a string) is equal to any of the elements in the array (all of them arrays)

    Edit:

    To achieve what you want you can use a “hack”. Instead of in_array you can use something like:

    $search_key = array_search(array('id'=>true,'link'=>$value2['link']), $feed_content);//use true for the id, as the comparison won't be strict
    if (false !== $search_key)//stict comparison to be sure that key 0 is taken into account
    {
        echo 'match here';
    }
    

    this thing relies on the fact that you can use an array for the search needle for the array_search function and that the comparison won’t be strict, so true will match any number (except 0, but I guess that you don’t use 0 as an id)

    this way the only field that will really matter is the one for the link

    after that you need to use a strict comparison this time to be sure that if the found key is 0 you will use it

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

Sidebar

Related Questions

This code alerts 'test 1', then alerts 8! uri = 'http://www.scriptcopy.com/'; compareuris = new
I'm parsing data from this RSS feed: http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=SAM|AR|AR005|MONTE%20MAIZ , The data there updates once
Here is my code: <?php $RSSFEEDS = array( 0 => http://samnabi.posterous.com/rss.xml, ); function FormatRow($date,
I'm reading a rss feed using simple code: <?php $homepage = file_get_contents('http://www.forbes.com/news/index.xml'); $movies =
I have an array shown below [ 'http://api.tweetmeme.com/imagebutton.gif?url=http://mashable.com/2010/09/25/trailmeme/', 'http://cdn.mashable.com/wp-content/plugins/wp-digg-this/i/gbuzz-feed.png', 'http://mashable.com/wp-content/plugins/wp-digg-this/i/fb.jpg', 'http://mashable.com/wp-content/plugins/wp-digg-this/i/diggme.png', 'http://ec.mashable.com/wp-content/uploads/2009/01/bizspark2.gif', 'http://cdn.mashable.com/wp-content/uploads/2010/09/web.png', 'http://mashable.com/wp-content/uploads/2010/09/Screen-shot-2010-09-24-at-10.51.26-PM.png',
<td> <img src=http://blog.garethjmsaunders.co.uk/wp-content/feed-icon-16x16.gif/> My feed </td> This is how it looks like: (source: garethjmsaunders.co.uk
I've been seeing this in my Visual C# 2008 RSS Feed forever now: http://lincolnfair.net/oldLincolnFair/mad.jpg
I have this table: id feed_id ... Let's say that I have 500 rows
I'm trying to get the video data from this youtube playlist feed and add
This is a new gmail labs feature that lets you specify an RSS feed

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.