$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