PHP Tutorial

PHP Examples

PHP Practice

PHP Code to print text using print command

In this PHP Code you will learn how to print string of string from variables on the webpage using print command?


print(string $expression): int

Source Code with Output to print text on webpage

/*print string*/
print "Hello world\n";

/*print variable values*/
$text = "Sample text";
$lucky_number = 100;

print "</br>";

print "Value of text is: " . $text . " Lucky number is: " . $lucky_number . "\n";


Hello world
Value of text is: Sample text Lucky number is: 100 

The following PHP topics are used in the above examples:

PHP Basic Programs »

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.