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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:23:13+00:00 2026-06-09T17:23:13+00:00

I am looking for a way (in PHP) to use two different arrays to

  • 0

I am looking for a way (in PHP) to use two different arrays to get results for matching items. The arrays are sport stats. One array contains the definition of the stats and the other is the stat_id and a stat value for a player. The matching item in each array is stat_id. I am looking to get back results of only matching items in both arrays.

The first array contains stat definitions. Here is a potion of the stats definition array…

[stat] => Array
    (
        [0] => SimpleXMLElement Object
            (
                [stat_id] => 4
                [enabled] => 1
                [name] => Passing Yards
                [display_name] => Pass Yds
                [sort_order] => 1
                [position_type] => O
            )

        [1] => SimpleXMLElement Object
            (
                [stat_id] => 5
                [enabled] => 1
                [name] => Passing Touchdowns
                [display_name] => Pass TD
                [sort_order] => 1
                [position_type] => O
            )

        [2] => SimpleXMLElement Object
            (
                [stat_id] => 6
                [enabled] => 1
                [name] => Interceptions
                [display_name] => Int
                [sort_order] => 0
                [position_type] => O
            )

        [3] => SimpleXMLElement Object
            (
                [stat_id] => 9
                [enabled] => 1
                [name] => Rushing Yards
                [display_name] => Rush Yds
                [sort_order] => 1
                [position_type] => O
            )

        [4] => SimpleXMLElement Object
            (
                [stat_id] => 10
                [enabled] => 1
                [name] => Rushing Touchdowns
                [display_name] => Rush TD
                [sort_order] => 1
                [position_type] => O
            )

        [5] => SimpleXMLElement Object
            (
                [stat_id] => 12
                [enabled] => 1
                [name] => Reception Yards
                [display_name] => Rec Yds
                [sort_order] => 1
                [position_type] => O
            )

        [6] => SimpleXMLElement Object
            (
                [stat_id] => 13
                [enabled] => 1
                [name] => Reception Touchdowns
                [display_name] => Rec TD
                [sort_order] => 1
                [position_type] => O
            )

        [7] => SimpleXMLElement Object
            (
                [stat_id] => 15
                [enabled] => 1
                [name] => Return Touchdowns
                [display_name] => Ret TD
                [sort_order] => 1
                [position_type] => O
            )

        [8] => SimpleXMLElement Object
            (
                [stat_id] => 16
                [enabled] => 1
                [name] => 2-Point Conversions
                [display_name] => 2-PT
                [sort_order] => 1
                [position_type] => O
            )

        [9] => SimpleXMLElement Object
            (
                [stat_id] => 18
                [enabled] => 1
                [name] => Fumbles Lost
                [display_name] => Fum Lost
                [sort_order] => 0
                [position_type] => O
            )

        [10] => SimpleXMLElement Object
            (
                [stat_id] => 57
                [enabled] => 1
                [name] => Offensive Fumble Return TD
                [display_name] => Fum Ret TD
                [sort_order] => 1
                [position_type] => O
            )

        [11] => SimpleXMLElement Object
            (
                [stat_id] => 19
                [enabled] => 1
                [name] => Field Goals 0-19 Yards
                [display_name] => FG 0-19
                [sort_order] => 1
                [position_type] => K
            )

        [12] => SimpleXMLElement Object
            (
                [stat_id] => 20
                [enabled] => 1
                [name] => Field Goals 20-29 Yards
                [display_name] => FG 20-29
                [sort_order] => 1
                [position_type] => K
            )

    )

Here is the player stat values array.

[stat] => Array
    (
        [0] => SimpleXMLElement Object
            (
                [stat_id] => 4
                [value] => 0
            )

        [1] => SimpleXMLElement Object
            (
                [stat_id] => 5
                [value] => 0
            )

        [2] => SimpleXMLElement Object
            (
                [stat_id] => 6
                [value] => 0
            )

        [3] => SimpleXMLElement Object
            (
                [stat_id] => 9
                [value] => 0
            )

        [4] => SimpleXMLElement Object
            (
                [stat_id] => 10
                [value] => 0
            )

        [5] => SimpleXMLElement Object
            (
                [stat_id] => 12
                [value] => 0
            )

        [6] => SimpleXMLElement Object
            (
                [stat_id] => 13
                [value] => 0
            )

        [7] => SimpleXMLElement Object
            (
                [stat_id] => 15
                [value] => 0
            )

        [8] => SimpleXMLElement Object
            (
                [stat_id] => 16
                [value] => 0
            )

        [9] => SimpleXMLElement Object
            (
                [stat_id] => 18
                [value] => 0
            )

        [10] => SimpleXMLElement Object
            (
                [stat_id] => 57
                [value] => 0
            )

    )
  • 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-09T17:23:15+00:00Added an answer on June 9, 2026 at 5:23 pm

    I think you are looking for one of the array_intersect functions:

    • http://www.php.net/manual/en/function.array-intersect.php
    • http://www.php.net/manual/en/function.array-intersect-assoc.php
    • http://www.php.net/manual/en/function.array-intersect-key.php

    These allow you to compare arrays and find the overlap based on matching values, matching keys, or both.

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

Sidebar

Related Questions

Few days ago i was looking for way to use my custom php on
I am looking for a way to make my own login formular in PHP
I'm looking for a way to make word-wrap in PHP a bit smarter. So
I'm looking for the best way to escape some Javascript text in PHP, and
I am looking for the best way to str_pad floats in php. The problem
My problem is that I was looking for way to use both storyboard and
The setup: I have a standard .php file (index.php) that contains two includes, one
I have a PHP array and what I am trying to do is use
I am looking for a way to maintain PHP sessions across multiple domains on
I'm looking for way to create list view as like in IOS with pinned

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.