preg_match("/(.*?)\|(\d*)/", $payerName, $array);其中$A = $array[1],$B = $array[2];

解决方案 »

  1.   

    $payerName="西瓜A|40";
    $explode_data = explode('|',$payerName);
      

  2.   


    $payerName="西瓜A|40" 
    list($A, $B) = explode('|', $payerName);
      

  3.   

    $payerName="西瓜A|40" ;
    $tmp = explode("|",$payerName);
    $A = $tmp[0];
    $B = $tmp[1];
    string substr ( string string, int start [, int length] )substr($payerName,0,X);//从左面取X个字符。
    substr($payerName,-X,X);//从右面取X个字符。