代码
<?php
namespace _0811;
echo '----------------------数组函数:array_diff---------------------------------<br>';
$a = ['小明', '小红', '小丽', '小黄'];
$b = ['小蓝', '小明', '小五', '小王'];
print_r(array_diff($a, $b));
echo '<br>----------------------数组函数:array_intersect---------------------------------<br>';
print_r(array_intersect($a, $b));
echo '<br>----------------------数组函数:array_merge---------------------------------<br>';
print_r(array_merge($a, $b));
echo '<br>----------------------数组函数:array_unique---------------------------------<br>';
$c = ['小明', '小红', '小丽', '小黄', '小蓝', '小明', '小五', '小王'];
print_r(array_unique($c));
echo '<br>----------------------数组函数:array_column---------------------------------<br>';
$d = [
['name' => '小明', 'age' => 18],
['name' => '小红', 'age' => 22],
['name' => '小丽', 'age' => 35],
];
print_r(array_column($d, 'name'));
echo '<br>----------------------数组函数:array_slice---------------------------------<br>';
print_r(array_slice($c, 2, 6));
运行效果