You need double quotes for variable names to be be expanded inside a string.
However, as you are using 3 variables, I would concatenate the string instead to avoid confusion:
$row[] = $aRow[ $aColumns[$i] ]
? ('<a href=\'http://osu.ppy.sh/d/' . $aRow[$aColumns[$i]] . '\'>test</a>')
: $aRow[ $aColumns[$i] ];