Loading...
PHP

Types Of Output Function In PHP

Output functions are used to display text on web page. The different types of output functions are given below.

  1. print:  This function is used to display the output on the browser and return value as true if output is printed successfully or it returns false.
    <?php
    $rv=print “Webnoid”;
    print $rv;
    ?>
  2. Echo: This function is same as print function but it doesn’t return any value. So it perform faster than print function. We can also print multiple statements with single echo function.
    <?php
    echo “Webnoid”, “Schools”;
    ?>
  3. var_dump: This function is used to display value of variables along with data type.
    <?php
    $sno=100;
    $uname= “Webnoid”;
    var_dump($sno);
    var_dump($uname);
    ?>
  4. printf: This function is used to display the value along with format specifier.
    <?php
    $sno=100;
    $uname=”Webnoid”;
    printf(“%d”, $sno);
    printf(“%s”, $uname);
    ?>
  5. print_r: This function is used to display all elements of array variable and properties of object 
  6. isset: This function is used to check whether the variable is set with any value or not 
    <?php
    $no =100;
    echo isset($no);
    ?>
  7. unset: This function is used to delete the value of the variable.
    <?php
    $no=100;
    unset($no);
    echo isset($no);
    ?>

Leave a Reply

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