[HELP ME] create product code using PHP?

I am from Indonesia
help me, how to create logic of product code in accordance with the product name using script PHP?
example :
input product name : Toshiba Dynabook SS2000 Japan Product Notebook
then saved, product code become TDSJPN001

so that each combination of initial letters + three-digit number


Thanks, I’ll try

function productCode($productName,$productID){
	$productCode = '';
	$y = explode(' ',$productName);
	foreach($y AS $k){
		$productCode .= strtoupper(substr($k,0,1));
	return $productCode.$productID;

echo productCode('Toshiba Dynabook SS2000 Japan Product Notebook','001');