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?

Syntax

print(string $expression): int

Source Code with Output to print text on webpage

<?php
/*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";
?>

Output

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

PHP Basic Programs »



ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT


Top MCQs

Comments and Discussions!




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.