"/>
Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

  1. What will be the output of the following PHP code?

    <?php

    function calc($price, $tax="")

    {

    $total = $price + ($price * $tax);

    echo "$total";

    }

    calc(42);

    ?>

  2. A.

     Error

    B.

     0

    C.

     42

    D.

     84

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    You can designate certain arguments as optional by placing them at the end of the list and assigning them a default value of nothing.


Be The First To Comment