컴

print - 문자열을 출력합니다.

· 2017-05-04 (목) 23:46:26 · 2736 · 1

print - 문자열을 출력합니다.

 

설명 ¶

 

int print ( string $arg )

출력 arg.

 

print 는 실제 함수가 아니며 (언어 구조이므로) 인수 목록에 괄호를 사용할 필요가 없습니다.

 

에코 의 주된 차이점 은 print 가 단일 인수만을 받아들이고 항상 1을 반환한다는 것입니다.

 

매개 변수 ¶

 

arg

입력 데이터.

 

반환 값 ¶

 

항상 1 을 반환합니다 .

 

예 ¶

 

예제 # 1 인쇄 예제

 

<?php

print("Hello World");

 

print "print() also works without parentheses.";

 

print "This spans

multiple lines. The newlines will be

output as well";

 

print "This spans\nmultiple lines. The newlines will be\noutput as well.";

 

print "escaping characters is done \"Like this\".";

 

// You can use variables inside a print statement

$foo = "foobar";

$bar = "barbaz";

 

print "foo is $foo"; // foo is foobar

 

// You can also use arrays

$bar = array("value" => "foo");

 

print "this is {$bar['value']} !"; // this is foo !

 

// Using single quotes will print the variable name, not the value

print 'foo is $foo'; // foo is $foo

 

// If you are not using any other characters, you can just print variables

print $foo;          // foobar

 

print <<<END

This uses the "here document" syntax to output

multiple lines with $variable interpolation. Note

that the here document terminator must appear on a

line with just a semicolon no extra whitespace!

END;

?>


|

댓글 1개

2022-09-02 (금) 15:03:58
감사합니다!
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
PHP 17-05-05 조회 2,664
PHP 17-05-04 조회 2,737
PHP 17-05-04 조회 3,116
PHP 17-05-04 조회 2,605
node.js 17-04-30 조회 2,485
jQuery 17-04-14 조회 2,101
jQuery 17-04-14 조회 2,196
jQuery 17-04-14 조회 2,532
PHP 17-04-14 조회 2,601
PHP 17-04-14 조회 2,883
PHP 17-04-14 조회 2,820
jQuery 17-04-13 조회 1,885
jQuery 17-04-13 조회 1,855
jQuery 17-04-13 조회 2,388
PHP 17-04-11 조회 2,729
PHP 17-04-11 조회 2,244
PHP 17-04-11 조회 2,965
OS 17-04-11 조회 3,262
PHP 17-04-10 조회 2,399
PHP 17-04-10 조회 2,009
PHP 17-04-10 조회 2,442
PHP 17-04-05 조회 2,456
PHP 17-04-05 조회 2,868
PHP 17-04-05 조회 2,710
jQuery 17-04-05 조회 2,311
jQuery 17-04-05 조회 1,847
jQuery 17-04-05 조회 2,438
jQuery 17-04-04 조회 2,351
jQuery 17-04-04 조회 2,124
PHP 17-04-04 조회 3,079