Answers for "add multiple array values in php"

PHP
3

how to add two array in single array without repetation in php

<?php
	$array1=array("CPU","Mouse","Monitor");
	$array2=array("Key-Board","Monitor","Printer");
	$array = array_unique(array_merge($array1, $array2));
	print_r($array);
?>
Posted by: Guest on October-24-2020
1

in array php multiple values

$haystack = array(...);

$target = array('foo', 'bar');

if(count(array_intersect($haystack, $target)) == count($target)){
    // all of $target is in $haystack
}

if(count(array_intersect($haystack, $target)) > 0){
    // at least one of $target is in $haystack
}
Posted by: Guest on May-26-2020

Code answers related to "add multiple array values in php"

Browse Popular Code Answers by Language