Bagaimana cara membuat Baris Baru di PHP?

5
(1)

Baris Baru membantu halaman terlihat lebih baik dan rapi. Kita akan belajar memasukkan baris baru ke dalam PHP menggunakan 2 cara.

  • Menggunakan Line Breaks seperti pada HTML
  • Menggunakan tag Baris Baru

Menggunakan Line Breaks seperti di HTML: Tag
di HTML digunakan untuk memberikan jeda baris tunggal. Ini adalah tag kosong, jadi tidak mengandung tag akhir.

Sintaksis:

</br>

Contoh:

PHP

<?php

echo "Akshit ". "<br>". "Loves GeeksForGeeks";

?>

Keluaran

Akshit 
Loves GeeksForGeeks

Menggunakan tag baris baru: Karakter baris baru n atau r n dapat digunakan untuk membuat baris baru di dalam kode sumber.

Syyntax:

 "n"

Contoh 1:

PHP

<?php

echo "Akshit " ."n"."Loves GeeksForGeeks";

?>

Keluaran

Akshit 
Loves GeeksForGeeks

Sintaksis:

"rn"

Contoh 2:

PHP

<?php

echo "Akshit " ."rn"."Loves GeeksForGeeks";

?>

Keluaran

Akshit 
Loves GeeksForGeeks

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.