Answers for "php get values that exist in both arrays"

PHP
0

check if all values in array are equal php

if(count(array_unique($array)) === 1) {
    // all values in $array are the same
} else {
    // at least 1 value in $array is different
}
Posted by: Guest on July-08-2020
0

php check if all values in array are equal

$allvalues = array('true', 'true', 'true');
if (count(array_unique($allvalues)) === 1 && end($allvalues) === 'true') {
}
Posted by: Guest on June-09-2020
0

php get values that exist in both arrays

$a=["a","b","c","d","e"];
$b=["d","e","f","g"];
$inBothAndB = array_intersect($a, $b); // Array([3] => d [4] => e)
Posted by: Guest on October-13-2021

Code answers related to "php get values that exist in both arrays"

Browse Popular Code Answers by Language