Output functions in PHP


Output functions in PHP

 


Print() :- this function display the content on web page and returns a Boolean value true (or) false.

By using print function we can print only one statement

<?php

$a=print(‘welcome to php’);

Print $a; //it returns a value ‘1’ or ‘0’

?>

 

Echo :-

This function print multiple statement at once it will not return any value that’s why performance is faster than print.

<?php

Echo (“welcome to php”,”web tech….”);

?>

Printf () :-

              <?php

Printf ( “ %s wants %d apples”,”roshan”, 10)

?>

Sprint f () :-

                 Instead of displaying value on webpage this function will return the values

<? Php

$a=sprint (“%s wants %d apples”,”scott”, 10) ;

Echo $a;

?>

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *