$s = $testObj->str;
假设//
echo $s
作品//
然而$out = "foo" . $s . "bar;
echo $out;
不try()类型转换和strval,实在想不出还能做什么
第二个字符串有打字错误。应该是:
$out = "foo" . $s . "bar";
echo $out;
实际上你可以这样做
$str = "foo{$testObj->str}bar";
echo $str;
这里. .测试用例:http://codepad.viper-7.com/8PCCkK