Literal string adalah notasi untuk mewakili nilai string dalam teks program komputer. Di PHP, string dapat dibuat dengan tanda kutip tunggal, tanda kutip ganda atau menggunakan sintaks heredoc atau nowdoc
In this code example, we create two strings and assign them to
$a
and$b
variables. We print them with theecho
keyword. The first string is created with the double quote delimiters, the second one with single quotes.PHP string heredoc
The heredoc preserves the line breaks and other whitespace [including indentation] in the text. The heredoc is created with
echo "Towering\tinferno\n"; Towering inferno
Tab horizontal menempatkan spasi di antara teks
In this code example, we create two strings and assign them to
$a
and$b
variables. We print them with theecho
keyword. The first string is created with the double quote delimiters, the second one with single quotes.PHP string heredoc
The heredoc preserves the line breaks and other whitespace [including indentation] in the text. The heredoc is created with