문자열 붙이기

by 조쉬 posted Apr 14, 2015
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

두개의 string을 합치는 연결연산자 . 을 사용한다는 것을 기억하자!


<?php

$a 
"Hello ";
$b $a "World!"// 연결연산자 "."로 연결하여 반환 "Hello World!"

$a "Hello ";
$a .= "World!";     // 오른쪽 인수를 왼쪽인수에 덧붙인다 "Hello World!"
?>


<?php
echo "thr"."ee";       // prints the string "three"

echo "twe" . "lve";    // prints the string "twelve"

echo 1 . 2;             // prints the string "12"

echo 1.2;               // prints the number 1.2

echo 1+2;              // prints the number 3

?>


<?php
$contentsaddr = 'http://test.com/rvproject/web/data/'.$new_file;

?>