尝试下:这样
<?php 
$str_3="测试"; 
echo '{$str_3}'.'4'; 
?>

解决方案 »

  1.   

    echo '{$str_3}'.4; 在这句话中,4是整型,而.是字符串连接符
      

  2.   

    虽然PHP是弱类型语言,只是说明在声明变量的时候不需要说明类型,并不表明没有类型这个概念了
      

  3.   

    那么在asp(asp中也是弱类型语言啊.)中为什么会成功运行,不报错如下:
    <script language="vbscript" runat="server">
    Response.Write "你好" & 1
    </script>
      

  4.   


    <?php
    $str_3="测试";
    $a = 5;
    echo '{$str_3}'. 5; # 注意空格
    echo '{$str_3}'.(string)5;
    echo '{$str_3}'.$a;
    echo '{$str_3}',5; # 注意逗号
    echo PHP_VERSION; # 5.2.5 在说明此类问题的时候请说明版本号.
    ?>相关的一些代码<?php
    # 手册
    echo "2 + 2 = " . 2+2; // This will print 4
    echo "2 + 2 = " , 2+2; // This will print 2+2 = 4# 转型
    echo  "1test"+1; # 2
    echo 1.1; # 1.1
    ?>
    除了第一行用空格解决的情况外 你可以理解为不可以用连接符直接连接一个整形.
      

  5.   

    晕!~~~~~~~~~~~~~~~
    <?php
    echo "测试",4;
    ?>
    上面的逗号在php中到底起什么作用啊?哪位朋友能站出来解释一下啊/
      

  6.   


    void echo ( string $arg1 [, string $... ] )
    Outputs all parameters. echo() is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo() (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo(), the parameters must not be enclosed within parentheses. echo() also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. This short syntax only works with the short_open_tag configuration setting enabled. 
    echo 是用来输出多个字符串的这里的逗号只是说明前面的字符串已经结束了.下面是一个新的字符串.也就是说你这里的4是echo要输出的第二个参数.
      

  7.   

    谢谢你了.system128你就是我的师傅了,我这网速慢得要死,没有结贴成功,但是我不是那没有良心的人,事情没有办到,话要说到,谢谢你:system128