'[PHP] 문자열 붙이기'에 해당되는 글 1건

728x90

[PHP] 문자열 붙이기


두개의 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;

?>

'Web 프로그램 > PHP 문법' 카테고리의 다른 글

[PHP기초] PHP 파일 다루기  (0) 2014.11.28
[PHP기초] fopen 파일 열기  (0) 2014.09.11
[PHP] 문자열 치환하기  (0) 2014.05.10
[PHP] 문자열 나누기  (0) 2014.05.09
[PHP] 조건문 처리  (1) 2014.05.06
블로그 이미지

Link2Me

,