Introduction
The print statement shows text or values on the screen. It helps you see results or messages when your program runs.
The print statement shows text or values on the screen. It helps you see results or messages when your program runs.
print "text or value";
print "Hello, world!";
print 'PHP is fun!';
print 123;
This program prints a welcome message, then a new line, then the number 2024.
<?php print "Welcome to PHP programming!"; print "\n"; print 2024; ?>
Use \n inside double quotes to add a new line.
print is a language construct, so parentheses are optional.
Print shows text or values on the screen.
Use quotes for text, no quotes for numbers.
End each print statement with a semicolon.
print statement do in PHP?print statement is used to display output on the screen in PHP.print 123;
print " apples";
print 123; prints the number 123 without quotes.print " apples"; prints the text ' apples' with a space before apples.print "Hello World"
PHP version: 8.1 using a single print statement with a variable $version = 8.1;?Pass the test and this pattern moves unknown