Type Casting

Card Set Information

Author:
starkisspk
ID:
9544
Filename:
Type Casting
Updated:
2010-03-25 03:26:05
Tags:
basics
Folders:

Description:
Type Casting in PHP
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user starkisspk on FreezingBlue Flashcards. What would you like to do?


  1. what is the output of:
    var_export((float)"bob");
    0
  2. what is the output of the following
    var_export((float)"13.0ad");
    13
  3. What is the output of the following:
    var_export((float)"g423);
    0
  4. What is the output of the following:
    var_export((float)array());
    0
  5. What is the output of the following:
    var_export((float)array(0));
    1

    //none empty array evaluate to true
  6. What is the output of the following:
    var_export((float)NULL);
    0
  7. What is the output of the following:
    var_export((float)"NULL");
    • 0
    • //converting a non-empty string
  8. What is the output of the following:
    var_export((float)" ")
    0
  9. What is the output of the following:
    var_export((float)"00000");
    0
  10. What is the output of the following:
    var_export((float)" 383");
    383
  11. What is the ouput of the following:
    var_export((float)(new stdClass()));
    1

    //1 is the output //in php 4 however it is 0
  12. What is the output of the following:
    var_export((bool)array());
    false
  13. What iis the ouput of the following:
    var_export((bool)" ")
    • true
    • //white space strings evaluate to true
  14. What is the output of the following:
    var_export((bool)-1);
    true
  15. What is the ouput of the following:
    var_export((bool)array(0));
    true
  16. What is the ouput of the following:
    var_export((bool)"NULL");
    true
  17. Whatt is the output of the following:
    var_export((bool)" ");
    true
  18. Whatt is the output of the following:
    var_export((bool)"00000");
    true
  19. Whatt is the output of the following:
    var_export((string)NULL);
    • ''
    • //output is empty string
  20. Whatt is the output of the following:
    var_export((string)array());
    • Array
    • //output is word 'Array'
  21. Whatt is the output of the following:
    var_export((string)array(0));
    • Array
    • //ouput is string 'Array'
  22. What is the output of :
    $b = array('name' => 'ryan', 'age'=>17, 55 => 'nothing', 98);var_dump((object)$b);
    object(stdClass)#2 (4) { ["name"]=> string(4) "ryan" ["age"]=> int(17) [55]=> string(7) "nothing" [56]=> int(98) }
  23. What is the ouput of the following:
    var_dump((object)4);
    object(stdClass)#2 (1) { ["scalar"]=> int(4) }
  24. What is the ouput of the following:
    var_dump((object)"safs847");
    // object(stdClass)#2 (1) { ["scalar"]=> string(7) "safs847" }
  25. If form was submitted with the following:
    <input type='text' name='age' value='20'>
    What need to be set in php.ini file to allow you to do
    <?php
    if($age < 25)
    print $age.' is too young';
    ?>
    register_globals

    register_globals need to be be to a value of 'on or 1'

    register_globals = 1
  26. What is the output of the following?
    echo 1 . 2;
    echo 1.2;
    echo 1 + 2;
    • //prints the string "12"
    • //prints the number 1.2
    • /prints the number 3

What would you like to do?

Home > Flashcards > Print Preview