PHP basic array value array 1 & nbsp; (& nbsp; [0] & nbsp ;=& gt; & nbsp; company & nbsp; [1] & nbsp ;=& gt; & nbsp; online & nbsp; [2] & nbsp ;=& gt; & nbsp; call & nbsp; [3] & nbsp ;=& gt; & nb PHP base array values
Array 1 ([0] => company [1] => online [2] => call [3] => banner [4] => archive)
Array 2 ([0] => company [1] => banner [2] => archive [3] => logo [4] => movie [5] => product)
How can I obtain the existing array 1, 2?
Array 3 ([0] => online [1] => call)
Array 4 ([0] => logo [1] => movie [2] => product) php basic array value
------ Solution --------------------
$a1 = array('company', 'online', 'call', 'banner', 'archive');
$a2 = array('company', 'banner', 'archive', 'logo', 'movie', 'product');
print_r(array_diff($a1, $a2));
print_r(array_diff($a2, $a1));
Array
(
[1] => online
[2] => call
)
Array
(
[3] => logo
[4] => movie
[5] => product
)
------ Solution --------------------
$ar1 = array('company', 'online', 'call', 'banner', 'archive');
$ar2 = array('company', 'banner', 'archive', 'logo', 'movie', 'product');
$ar3=array_slice($ar1,1,2);
$ar4=array_slice($ar2, 3);
print_r($ar3);
print_r($ar4);
------ Solution --------------------
The two upstairs have the same results, but their ideas are completely different.
#1. difference set
#2 obtain the clip
LZ did not clarify the purpose, so you should find out your needs when selecting ......
------ Solution --------------------
Thank you for sharing...
------ Solution --------------------
I don't know your intention
------ Solution --------------------
What does lz mean? Does it match different companies?