Note that there are some explanatory texts on larger screens.

plurals
  1. POsearching an array for relevant information
    primarykey
    data
    text
    <p>I have an array that looks like this, </p> <pre><code> Array ( [0] =&gt; Array ( [career_overview_id] =&gt; 1 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; [candidates_candidate_id] =&gt; 37 ) [1] =&gt; Array ( [career_overview_id] =&gt; 2 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; [candidates_candidate_id] =&gt; 37 ) [2] =&gt; Array ( [career_overview_id] =&gt; 3 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; [candidates_candidate_id] =&gt; 37 ) [3] =&gt; Array ( [career_overview_id] =&gt; 4 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; voice over [candidates_candidate_id] =&gt; 37 ) [4] =&gt; Array ( [career_overview_id] =&gt; 5 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; voice over [candidates_candidate_id] =&gt; 37 ) [5] =&gt; Array ( [career_overview_id] =&gt; 6 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; voice over [candidates_candidate_id] =&gt; 37 ) [6] =&gt; Array ( [career_overview_id] =&gt; 7 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; voice over [candidates_candidate_id] =&gt; 37 ) [7] =&gt; Array ( [career_overview_id] =&gt; 8 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; voice over [candidates_candidate_id] =&gt; 37 ) [8] =&gt; Array ( [career_overview_id] =&gt; 9 [production_title] =&gt; Televison Show [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; voice over [candidates_candidate_id] =&gt; 37 ) [9] =&gt; Array ( [career_overview_id] =&gt; 10 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; television [candidates_candidate_id] =&gt; 37 ) [10] =&gt; Array ( [career_overview_id] =&gt; 11 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; television [candidates_candidate_id] =&gt; 37 ) [11] =&gt; Array ( [career_overview_id] =&gt; 12 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; television [candidates_candidate_id] =&gt; 37 ) [12] =&gt; Array ( [career_overview_id] =&gt; 13 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; television [candidates_candidate_id] =&gt; 37 ) [13] =&gt; Array ( [career_overview_id] =&gt; 14 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; television [candidates_candidate_id] =&gt; 37 ) [14] =&gt; Array ( [career_overview_id] =&gt; 15 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; television [candidates_candidate_id] =&gt; 37 ) [15] =&gt; Array ( [career_overview_id] =&gt; 16 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; television [candidates_candidate_id] =&gt; 37 ) [16] =&gt; Array ( [career_overview_id] =&gt; 17 [production_title] =&gt; Production Title [production_role] =&gt; Role [production_director] =&gt; Director [production_company] =&gt; Production Company [production_producer_theartre] =&gt; [production_project_type] =&gt; [production_product] =&gt; [production_agency] =&gt; [production_type] =&gt; theartre [candidates_candidate_id] =&gt; 37 ) ) </code></pre> <p>I want to search through the array and if for example a production_type = "television" exists I want to show some HTML.</p> <p>Can I do this without looping through the array?</p> <p>In essence I want to do the following, </p> <pre><code>if key and value exists anywhere in array do something; </code></pre> <p>I am in the end wanting to construct a list of production_types but only list 1 instance of each type if they exist in the array.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload