变量为另一个变量

I have a variable ($uid) which fetches value from a database. My problem is that I am not able to append that variable to another variable ($str). The value of the $uid will be in place of '___' in the $str variable. How do I do approach?

$uid = 5;
$str ='ALPHA|___|NA|2|NA|NA|NA|INR|NA|NA|BETA|NA|NA|NA|NA|NA|NA|NA|NA|NA|NA';
//use this code 
$uid = 5; $str ='ALPHA|___|NA|2|NA|NA|NA|INR|NA|NA|BETA|NA|NA|NA|NA|NA|NA|NA|NA|NA|NA';
echo str_replace("___",$uid,$str);

try this $uid = 5;

$str ='ALPHA|___|NA|2|NA|NA|NA|INR|NA|NA|BETA|NA|NA|NA|NA|NA|NA|NA|NA|NA|NA';

echo str_replace("___",$uid,$str);

output : ALPHA|5|NA|2|NA|NA|NA|INR|NA|NA|BETA|NA|NA|NA|NA|NA|NA|NA|NA|NA|NA