Skip to content

Instantly share code, notes, and snippets.

@kraizt
Created April 7, 2017 07:50
Show Gist options
  • Save kraizt/87516d274cff420735b55e2566e4b980 to your computer and use it in GitHub Desktop.
Save kraizt/87516d274cff420735b55e2566e4b980 to your computer and use it in GitHub Desktop.
<?php
$input_one = ['Ricky Andika Putra', 'Ramadani', 'Asep Dadang Supriadi', 'Akmal Fuady', 'Yandi Fitriyanto'];
$input_two = ['Ricky Andika Putra', 'Yandi Fitriyanto', 'Muhammad Sholeh', 'Yadi Cahyadi'];
$result = array_count_values(array_merge($input_one, $input_two));
foreach ($result as $key => $value)
{
if($value == 2)
{
$hasil[] = $key;
}
}
print_r($hasil);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment