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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:17:46+00:00 2026-06-03T16:17:46+00:00

I have the follow arrays: Array $eventos : Array ( [0] => Array (

  • 0

I have the follow arrays:

Array $eventos:

Array (
    [0] => Array (
            [Evento] => Array (
                    [id] => 1
                    [nome] => Event 1
                )
            [Obreiro] => Array (
                    [0] => Array (
                            [id] => 2
                            [usuario_id] => 4
                            [nome] => Teste
                        )
                    [1] => Array (
                            [id] => 5
                            [usuario_id] => 8
                            [nome] => Teste
                         )
                )
        )
    [1] => Array (
            [Evento] => Array (
                    [id] => 2
                    [nome] => Event 2
                )

            [Obreiro] => Array (
                    [0] => Array (
                            [id] => 3
                            [usuario_id] => 6
                            [nome] => Teste
                        )
                    [1] => Array
                        (
                            [id] => 5
                            [usuario_id] => 7
                            [nome] => Teste
                        )
                )
        )
)

And array $obreiros:

Array (
    [0] => Array (
            [Obreiro] => Array (
                    [id] => 2
                    [usuario_id] => 4
                    [nome] => Foo
                )
        )
    [1] => Array (
            [Obreiro] => Array (
                    [id] => 5
                    [usuario_id] => 8
                    [nome] => Bar
                )
        )
)

I want to do:
For each $obreiros which is a user, show if participated or not of the event (defined in array $evento[x]['Obreiro'][y], where x and y are numbers).

Sample:

       | Event 1 | Event 2 | Event n
--------------------------------------
Foo    |    x    |         |    x    
Bar    |    x    |    x    |
Foo 2  |         |         |    x

How I can do this?

  • 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-03T16:17:48+00:00Added an answer on June 3, 2026 at 4:17 pm

    Have done the work with the code:

    foreach($obreiros as $kObreiro => $obreiro) {
        foreach($eventos as $kEvento => $evento) {
            $faltou = true;
    
            if(isset($evento['Obreiro']) && is_array($evento['Obreiro']) && count($evento['Obreiro']) > 0) {
                foreach($evento['Obreiro'] as $kEventoObreiro => $eventoObreiro) {
                    if($eventoObreiro['usuario_id'] == $obreiro['Usuario']['id']) {
                        $faltou = false;
                    }
                }
            }
    
            if($faltou) {
                echo'X';
            } else {
                echo' ';
            }
        }
        echo '<br />';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have two arrays as follow: $array1 = array(1, 3, 5); $array2
I have an array of strings as follow: [a1,a2,a1,a3,a2] I want to find the
I have two arrays $data1 = array() $data1 = array( '10','22','30') and also another
I have got a multidimensional array : [everything_list] => Array ( [follow] => Array
i have a simple array and i want to generate string which include all
I have two arrays as follows. And I want to pick up names from
I have the follow array, how do I write a loop to list the
I have an array that I want to permutate randomly. In Java, there is
I have an array as follow. var array:Array = new Array(); array[Circle] = 1;
I have a custom decorator as follow: $lang = $this->CreateElement('select', 'lang') ->setDecorators(array( array( array('elementDiv'

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.