douxiuyu2028 2018-07-03 05:40
浏览 35

变量为另一个变量

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';
  • 写回答

2条回答 默认 最新

  • dsklfsdlkf1232 2018-07-03 05:44
    关注
    //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);
    
    评论

报告相同问题?