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

$b = 2;

$c = $a + $b;

php两数相加php字符串相加含非数字的字符相加 Python

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