2011年9月22日木曜日

PHP(3) 文字列の扱い

PHPにおける文字の扱いと結合について.

文字列の結合

表示例

LINK

index3_1.php
<?php
        $word1 = 'Hello, ';
        $word2 = 'world';
        $str1 = $word1 . $word2;

        print($str1);
?>

文字列の追記

表示例

LINK

index3_2.php
<?php
        $word1 = 'Hello, ';
        $word2 = 'world';
        $str2 = $word1;
        $str2 .= $word2;

        print($str2);
?>

0 件のコメント: