php怎么替换前面第一个“$”

解决方案 »

  1.   


    不要激动第一个是指   $abcd 
    还是     abc$def看来我语文水平也很差。
      

  2.   

    $str = '$';
    $result = str_replace($str, "", 'He$llo Wor$ld of PHP');
    echo $result;
      

  3.   

    $str = '$joao#$$$';
    str_replace('\$', "", $str);
      

  4.   

    freedom_gooboy:
    $str = '$';
    $result = str_replace($str, "", 'He$llo Wor$ld of PHP');
    echo $result; //Hello World of PHPthinkinginAOCP:
    $str = '$joao#$$$';
    str_replace('\$', "", $str); //$joao#$$$楼主确实没把需求说清楚,估计是
    $str = '$chenxuezhi1986$$$';
    echo preg_replace('/\$/', "", $str, 1); //chenxuezhi1986$$$