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

$b = 2;

$c = $a + $b;

php数据相加php字符串相加含非数字的字符相加 Java

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