<?php

mb_internal_encoding("UTF-8");
$a = "ue34, 4y3, 4yt4we,";
$b = "43wt5, 235, 2v, 4y3,";
preg_match_all("/[A-Za-z_0-9]{1,10}/i", $a, $matches);
preg_match_all("/[A-Za-z_0-9]{1,10}/i", $b, $matches2);
$c = array();
$d = array();
foreach ($matches as $v)
{
	foreach ($v as $value)
	{

	$c[] = $value;
			
	}
}
foreach ($matches2 as $v)
{
	foreach ($v as $value)
	{

	$d[] = $value;
			
	}
}

foreach ($c as $key => $value) {
if (in_array($value, $d)) {
echo $value;
}
}