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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:34:19+00:00 2026-05-29T11:34:19+00:00

$record_record contains: Array ( [0] => Array ( [id] => 252 [origin] => laptop.me.

  • 0

$record_record contains:

Array
(
    [0] => Array
        (
            [id] => 252
            [origin] => laptop.me.
        )

    [1] => Array
        (
            [id] => 255
            [origin] => hello.me.
        )

    [2] => Array
        (
            [id] => 254
            [origin] => intel.me.
        ) 
)

I need to search if 255 is exist in the array. The code below didn’t work.

if (in_array('255', $record_record, true)) {
    echo "'255' found with strict check\n";
}
else {
     echo "nope\n";
} 

I had a feeling because it’s a nested array the function will not work. Help me please?

  • 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-29T11:34:20+00:00Added an answer on May 29, 2026 at 11:34 am

    You need to do something like this:

    <?php
    
      function id_exists ($array, $id, $strict = FALSE) {
        // Loop outer array
        foreach ($array as $inner) {
          // Make sure id is set, and compare it to the search value
          if (isset($inner['id']) && (($strict) ? $inner['id'] === $id : $inner['id'] == $id)) {
            // We found it
            return TRUE;
          }
        }
        // We didn't find it
        return FALSE;
      }
    
      if (id_exists($record_record, 255, true)) {
        echo "'255' found with strict check\n";
      } else {
        echo "nope\n";
      } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a recordset that contains only 1 record but I need to display
I have an Array in PHP which contains data from database. And it prints
I need to read in an Intel Hex file which looks something like this:
Below is a very simple bit of code that mimics a class structure in
(SOLVED, SEE END) I need hints on the PHP or MySQL code structure for
In Sencha Touch, I often need to have an Ext.DataView panel that contains a
I have a record that contains a dynamic array. It is normal that when
I have a csv file I need to cleanup. It contains 13 fields, but
I would like to declare a record in Delphi that contains the same layout
How to get the size of a record in MySql if the table contains

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.