PHP基础数组取值
数组1 ( [0] => company [1] => online [2] => call [3] => banner [4] => archive )
数组2 ( [0] => company [1] => banner [2] => archive [3] => logo [4] => movie [5] => product )
现有数组1,2,我该如何才能得出
数组3( [0] => online [1] => call )
数组4( [0] => logo [1] => movie [2] => product )
$a1 = array('company', 'online', 'call', 'banner', 'archive'); <br />$a2 = array('company', 'banner', 'archive', 'logo', 'movie', 'product');<br /> <br />print_r(array_diff($a1, $a2));<br />print_r(array_diff($a2, $a1));<br />Array
<br /> $ar1 = array('company', 'online', 'call', 'banner', 'archive'); <br /> $ar2 = array('company', 'banner', 'archive', 'logo', 'movie', 'product');<br /> $ar3=array_slice($ar1,1,2);<br /> $ar4=array_slice($ar2, 3);<br /> print_r($ar3);<br /> print_r($ar4);<br />