답변 3개 / 댓글 2개
채택된 답변
+20 포인트
PHP에서는 엔터를 쳐서 내려가도 실제 출력되는 html구문에는 엔터가 안나옵니다. 강제적으로 break line을 출력할 때 사용합니다.
$a="asdf";
$b="ghjk";
echo $a.PHP_EOL.$b;
를 하면
asdf
ghjk
가 되는것이죠
End Of Line 으로 일고 있습니다
5.0.2에서 추가된 예약상수인 것으로
php.net에서는 아래와 같이 설명하고 있네요.
PHP_EOL (string)
The correct 'End Of Line' symbol for this platform. Available since PHP 5.0.2
사용예는 그누보드에도 많이 있지만...
PHP_EOL can be used like that:
<?php
$data = 'some data'.PHP_EOL;
$fp = fopen('somefile', 'a');
fwrite($fp, $data);
?>
Which is the same of \r\n or \n depending on the OS.
You can put those lines in a while for example, and create a log file.
답변을 작성하려면 로그인이 필요합니다.