PHP Operators


  1. What will be the output of the following PHP code ?
    <?php
    $v = 'Mania';
    echo "Inter$view";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Inter, because $v became $view, which is undefined.


  1. What will be the output of the following PHP code ?
    <?php
    $str = 'view';
    echo 'Inter{$str}Mania';
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Inter{$str}Mania, single quotes are not parsed.



  1. What will be the output of the following PHP code ?
    <?php
    $str = 'view';
    print "Inter".$str."Mania";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    dereferences the variable/string within.


  1. What will be the output of the following PHP code ?
    <?php
    $str = 'view ';
    print "Inter{$str}Mania";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    {$}dereferences the variable within.



  1. What will be the output of the following PHP code ?
    <?php
    $num = '8' ;
    print + + $num;
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The character is type casted to integer before multiplying.