{"id":169015,"date":"2025-06-28T00:33:39","date_gmt":"2025-06-28T00:33:39","guid":{"rendered":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/"},"modified":"2025-06-28T00:33:39","modified_gmt":"2025-06-28T00:33:39","slug":"how-to-find-a-common-value-in-two-arrays-in-php","status":"publish","type":"post","link":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/","title":{"rendered":"How to find a common value in two arrays in PHP?"},"content":{"rendered":"<p>When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the most straightforward methods is to use the <code>array_intersect()<\/code> function. This function takes two arrays as parameters and returns an array containing values that are present in both arrays.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_62 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#1_How_can_you_use_the_array_intersect_function_to_find_common_values_in_two_arrays\" title=\"1. How can you use the array_intersect() function to find common values in two arrays?\">1. How can you use the array_intersect() function to find common values in two arrays?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#2_Are_the_common_values_returned_in_the_same_order_as_they_appear_in_the_input_arrays\" title=\"2. Are the common values returned in the same order as they appear in the input arrays?\">2. Are the common values returned in the same order as they appear in the input arrays?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#3_What_happens_if_one_of_the_input_arrays_contains_duplicate_values\" title=\"3. What happens if one of the input arrays contains duplicate values?\">3. What happens if one of the input arrays contains duplicate values?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#4_Can_you_find_common_values_between_more_than_two_arrays_using_the_array_intersect_function\" title=\"4. Can you find common values between more than two arrays using the array_intersect() function?\">4. Can you find common values between more than two arrays using the array_intersect() function?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#5_How_can_you_determine_the_number_of_common_values_between_two_arrays\" title=\"5. How can you determine the number of common values between two arrays?\">5. How can you determine the number of common values between two arrays?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#6_What_happens_if_there_are_no_common_values_between_the_two_arrays\" title=\"6. What happens if there are no common values between the two arrays?\">6. What happens if there are no common values between the two arrays?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#7_Is_there_an_alternative_method_to_find_common_values_in_two_arrays_without_using_the_array_intersect_function\" title=\"7. Is there an alternative method to find common values in two arrays without using the array_intersect() function?\">7. Is there an alternative method to find common values in two arrays without using the array_intersect() function?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#8_Can_you_find_common_values_between_associative_arrays_using_the_array_intersect_function\" title=\"8. Can you find common values between associative arrays using the array_intersect() function?\">8. Can you find common values between associative arrays using the array_intersect() function?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#9_How_can_you_ignore_the_case_sensitivity_when_finding_common_values_in_two_arrays\" title=\"9. How can you ignore the case sensitivity when finding common values in two arrays?\">9. How can you ignore the case sensitivity when finding common values in two arrays?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#10_Can_you_find_common_values_between_arrays_with_different_types_of_elements\" title=\"10. Can you find common values between arrays with different types of elements?\">10. Can you find common values between arrays with different types of elements?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#11_How_can_you_find_common_values_between_two_arrays_while_preserving_the_keys\" title=\"11. How can you find common values between two arrays while preserving the keys?\">11. How can you find common values between two arrays while preserving the keys?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#12_Is_it_possible_to_find_common_values_between_arrays_with_nested_arrays\" title=\"12. Is it possible to find common values between arrays with nested arrays?\">12. Is it possible to find common values between arrays with nested arrays?<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"1_How_can_you_use_the_array_intersect_function_to_find_common_values_in_two_arrays\"><\/span>1. How can you use the array_intersect() function to find common values in two arrays?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p><strong>To find a common value in two arrays in PHP, you can use the array_intersect() function. Simply pass the two arrays as arguments to the function, and it will return an array containing the common values.<\/strong><\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_Are_the_common_values_returned_in_the_same_order_as_they_appear_in_the_input_arrays\"><\/span>2. Are the common values returned in the same order as they appear in the input arrays?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>The <code>array_intersect()<\/code> function preserves the keys of the input arrays, but the common values are reindexed starting from zero in the resulting array.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_What_happens_if_one_of_the_input_arrays_contains_duplicate_values\"><\/span>3. What happens if one of the input arrays contains duplicate values?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>If one of the input arrays contains duplicate values, the <code>array_intersect()<\/code> function will only return those values once in the resulting array.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4_Can_you_find_common_values_between_more_than_two_arrays_using_the_array_intersect_function\"><\/span>4. Can you find common values between more than two arrays using the array_intersect() function?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, the <code>array_intersect()<\/code> function can take multiple arrays as arguments. It will return an array containing values that are present in all of the input arrays.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5_How_can_you_determine_the_number_of_common_values_between_two_arrays\"><\/span>5. How can you determine the number of common values between two arrays?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>You can use the <code>count()<\/code> function on the result of <code>array_intersect()<\/code> to determine the number of common values between two arrays.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_What_happens_if_there_are_no_common_values_between_the_two_arrays\"><\/span>6. What happens if there are no common values between the two arrays?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>If there are no common values between the two arrays, the <code>array_intersect()<\/code> function will return an empty array.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7_Is_there_an_alternative_method_to_find_common_values_in_two_arrays_without_using_the_array_intersect_function\"><\/span>7. Is there an alternative method to find common values in two arrays without using the array_intersect() function?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Another approach to finding common values in two arrays is to loop through one array and check if each value exists in the other array. This method may be less efficient for large arrays compared to using <code>array_intersect()<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"8_Can_you_find_common_values_between_associative_arrays_using_the_array_intersect_function\"><\/span>8. Can you find common values between associative arrays using the array_intersect() function?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, the <code>array_intersect()<\/code> function can be used to find common values between associative arrays. It compares the values rather than the keys of the input arrays.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9_How_can_you_ignore_the_case_sensitivity_when_finding_common_values_in_two_arrays\"><\/span>9. How can you ignore the case sensitivity when finding common values in two arrays?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>To ignore case sensitivity when comparing values, you can use the <code>array_map()<\/code> function to apply the <code>strtolower()<\/code> function to each value in the arrays before using <code>array_intersect()<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"10_Can_you_find_common_values_between_arrays_with_different_types_of_elements\"><\/span>10. Can you find common values between arrays with different types of elements?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, the <code>array_intersect()<\/code> function can handle arrays with different types of elements (e.g., strings, integers). It only compares the values, regardless of their types.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"11_How_can_you_find_common_values_between_two_arrays_while_preserving_the_keys\"><\/span>11. How can you find common values between two arrays while preserving the keys?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>If you want to preserve the keys of the input arrays while finding common values, you can use the <code>array_intersect_assoc()<\/code> function instead of <code>array_intersect()<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"12_Is_it_possible_to_find_common_values_between_arrays_with_nested_arrays\"><\/span>12. Is it possible to find common values between arrays with nested arrays?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><\/p>\n<p>Yes, you can find common values between arrays containing nested arrays by recursively applying the <code>array_intersect()<\/code> function to the nested arrays.<\/p>\n<p>By using the <code>array_intersect()<\/code> function in PHP, you can easily find common values between two arrays. This method is efficient and straightforward, making it a useful tool for array manipulation in PHP.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the most straightforward methods is to use the array_intersect() function. This function takes two arrays as parameters and returns an array containing values that are present in &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to find a common value in two arrays in PHP?\" class=\"read-more button\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#more-169015\">Read more<span class=\"screen-reader-text\">How to find a common value in two arrays in PHP?<\/span><\/a><\/p>\n","protected":false},"author":41,"featured_media":107420,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86279],"tags":[],"class_list":["post-169015","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to find a common value in two arrays in PHP?<\/title>\n<meta name=\"description\" content=\"When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to find a common value in two arrays in PHP?\" \/>\n<meta property=\"og:description\" content=\"When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/\" \/>\n<meta property=\"og:site_name\" content=\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/synchronyfinancial\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-28T00:33:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Alisha Bruce\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@synchrony\" \/>\n<meta name=\"twitter:site\" content=\"@synchrony\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alisha Bruce\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/\"},\"author\":{\"name\":\"Alisha Bruce\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/94ef8c983729b60de19bd9da87a2bdf0\"},\"headline\":\"How to find a common value in two arrays in PHP?\",\"datePublished\":\"2025-06-28T00:33:39+00:00\",\"dateModified\":\"2025-06-28T00:33:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/\"},\"wordCount\":554,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"articleSection\":[\"Learn\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/\",\"name\":\"How to find a common value in two arrays in PHP?\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\"},\"datePublished\":\"2025-06-28T00:33:39+00:00\",\"dateModified\":\"2025-06-28T00:33:39+00:00\",\"description\":\"When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the\",\"breadcrumb\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/namso-gen.co\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to find a common value in two arrays in PHP?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"description\":\"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co\",\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/namso-gen.co\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"contentUrl\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"width\":500,\"height\":164,\"caption\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\"},\"image\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/synchronyfinancial\",\"https:\/\/twitter.com\/synchrony\",\"https:\/\/www.youtube.com\/synchronyfinancial\",\"https:\/\/www.instagram.com\/synchrony\",\"https:\/\/www.linkedin.com\/company\/synchrony-financial\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/94ef8c983729b60de19bd9da87a2bdf0\",\"name\":\"Alisha Bruce\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"Alisha Bruce\"},\"description\":\"Guest author Alisha Bruce has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to find a common value in two arrays in PHP?","description":"When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/","og_locale":"en_US","og_type":"article","og_title":"How to find a common value in two arrays in PHP?","og_description":"When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the","og_url":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/","og_site_name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","article_publisher":"https:\/\/www.facebook.com\/synchronyfinancial","article_published_time":"2025-06-28T00:33:39+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png","type":"image\/png"}],"author":"Alisha Bruce","twitter_card":"summary_large_image","twitter_creator":"@synchrony","twitter_site":"@synchrony","twitter_misc":{"Written by":"Alisha Bruce","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#article","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/"},"author":{"name":"Alisha Bruce","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/94ef8c983729b60de19bd9da87a2bdf0"},"headline":"How to find a common value in two arrays in PHP?","datePublished":"2025-06-28T00:33:39+00:00","dateModified":"2025-06-28T00:33:39+00:00","mainEntityOfPage":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/"},"wordCount":554,"commentCount":0,"publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"articleSection":["Learn"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/","url":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/","name":"How to find a common value in two arrays in PHP?","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/#website"},"datePublished":"2025-06-28T00:33:39+00:00","dateModified":"2025-06-28T00:33:39+00:00","description":"When working with arrays in PHP, it is common to need to find common values between two arrays. There are several ways to achieve this, but one of the","breadcrumb":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/namso-gen.co\/blog\/how-to-find-a-common-value-in-two-arrays-in-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/namso-gen.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to find a common value in two arrays in PHP?"}]},{"@type":"WebSite","@id":"https:\/\/namso-gen.co\/blog\/#website","url":"https:\/\/namso-gen.co\/blog\/","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","description":"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co","publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/namso-gen.co\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/namso-gen.co\/blog\/#organization","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","url":"https:\/\/namso-gen.co\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","contentUrl":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","width":500,"height":164,"caption":"Namso Gen Blog - Free Credit Card Generator [100% Valid]"},"image":{"@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/synchronyfinancial","https:\/\/twitter.com\/synchrony","https:\/\/www.youtube.com\/synchronyfinancial","https:\/\/www.instagram.com\/synchrony","https:\/\/www.linkedin.com\/company\/synchrony-financial"]},{"@type":"Person","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/94ef8c983729b60de19bd9da87a2bdf0","name":"Alisha Bruce","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Alisha Bruce"},"description":"Guest author Alisha Bruce has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here."}]}},"_links":{"self":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/169015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/comments?post=169015"}],"version-history":[{"count":0,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/169015\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media\/107420"}],"wp:attachment":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media?parent=169015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/categories?post=169015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/tags?post=169015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}