1、根据指定的key,获取对应的值
//如:数组
$childSku = Array
(
[parent_id] => 0
[product_is_multi] => 1
[parent_sku] => SJ00442
[sku] => SJ00442-01
[siteid] => 15
[currency] => AUD
[ebay_account_id] => 94
[opration_id] => 1
[quantity] => 12.5700
[start_price] => 12.5700
[ean] => Does Not Apply
[isbn] => Does Not Apply
[upc] => Does Not Apply
[image_galleries] => a:3:{i:0;s:66:"http://120.78.243.154/upload/image/productImages/1488942810747.jpg";i:1;s:66:"http://120.78.243.154/upload/image/productImages/1488942370385.jpg";i:2;s:66:"http://120.78.243.154/upload/image/productImages/1488942384287.jpg";}
)
//获取指定key的值:
$needKey = ['quantity','start_price','ean','isbn','upc','image_galleries'];
//处理:array_intersect_key //使用键名比较计算数组的交集
$needArr = array_intersect_key($childSku,array_flip($needKey));
2、返回单元顺序相反的数组
array输入的数组。
preserve_keys
如果设置为 TRUE 会保留数字的键。 非数字的键则不受这个设置的影响,总是会被保留
array array_reverse ( array $array [, bool $preserve_keys = false ] )
3、根据指定的值,获取对应的key
$delIdArr = array_intersect_key(array_flip($alreadyAddValueArr),array_flip($delValueArr));
4、删除一维数组中,指定的值
$arr = array_merge(array_diff($arr, array($tmp)));
$arr = array_merge(array_diff($arr, $del));
$key=array_search($tmp ,$arr);
array_splice($arr,$key,1); #注意array_splice自动实现重置序列值。