$a = \"大众2\"大众;

$b = 2;

$c = $a + $b;

时间相加php实现php字符串相加含非数字的字符相加 HTML

var_dump($c);//4

---------------------------------------

$a = \"大众2abcd\公众;

$b = 2;

$c = $a + $b;

var_dump($c);//4

---------------------------------------

$a = \"大众abcd2\"大众;

$b = 2;

$c = $a + $b;

var_dump($c);//2

---------------------------------------

$a = \"大众2.1abcd2\公众;

$b = 2;

$c = $a + $b;

var_dump($c);//4.1