NAME

Question types


Start with


Question limit

of 23 available terms

Print test

23 True/False questions

  1. What is the result of combining a string with a number?When you combine a string with a number, the result is another string.

          

  2. What tag is used to cause PHP to start interpreting program code? And what is the short form of the tag?The tag used to start PHP interpreting code is <?php ... ?>, which can be shortened to <? ... ?> but is not recommended practice.

          

  3. Are variable names case-sensitive?Variable names are case-sensitive. So, for example,$This_Variable is not the same as $this_variable.

          

  4. Which symbol is used to preface all PHP variables?With the exception of constants, all PHP variables must begin with $.

          

  5. Superglobal variables,Are never reset and are only within the scope of the function. You cannot assign the result of an expression in their definitions.

          

  6. Can you use spaces in variable names?You cannot use spaces in variable names, as this would confuse the PHP parser. Instead, try using the _ (underscore).

          

  7. What is the difference between the echo and print commands?The echo and print commands are similar in that they are both constructs, except that print behaves like a PHP function and takes a single argument, while echo can take multiple arguments.

          

  8. How can you make a variable accessible to all parts of a PHP program?You can make a variable accessible to all parts of a PHP program by declaring it as global.

          

  9. What can a variable store?Are never reset and are only within the scope of the function. You cannot assign the result of an expression in their definitions.

          

  10. What are the two types of comment tags?You can use // for a single-line comment or / ... / to span multiple lines.

          

  11. If you generate data within a function, what are a couple of ways to convey the data to the rest of the program?You can use multiple lines within quotations marks or the <<<_END ... _END; construct to create a multiline echo or assignment. The closing tag must begin at the start of a line, and end with a semicolon followed by a new line.

          

  12. What is the difference between $variable = 1 and $variable == 1?The echo and print commands are similar in that they are both constructs, except that print behaves like a PHP function and takes a single argument, while echo can take multiple arguments.

          

  13. Why do you suppose an underscore is allowed in variable names (e.g., $current_user) whereas hyphens are not (e.g., $current-user)?A hyphen is reserved for the subtraction operators. A construct like $current-user would be harder to interpret if hyphens were also allowed in variable names and, in any case, would lead programs to be ambiguous.

          

  14. Using the htmlentities is important because...Using the htmlentities function for sanitization is an important practice in any circumstance where user or other third-party data is being processed for output, not just with superglobals.

          

  15. Are the operators && and and interchangeable?Generally, the operators && and and are interchangeable except where precedence is important, in which case && has a high precedence, while and has a low one.

          

  16. What is the purpose of functions?The purpose of functions is to separate discrete sections of code into their own, self-contained sections that can be referenced by a single function name.

          

  17. Can you redefine a constant?Variables hold a value that can be a string, a number, or other data.

          

  18. How do you escape a quotation mark?You can use \' or \" to escape either a single or double quote.

          

  19. What is the difference between ++$j and $j++?The echo and print commands are similar in that they are both constructs, except that print behaves like a PHP function and takes a single argument, while echo can take multiple arguments.

          

  20. Which character must be placed at the end of every PHP statement?All PHP statements must end with a semicolon (;).

          

  21. How do you convert one variable type to another (say, a string to a number)?When you combine a string with a number, the result is another string.

          

  22. How can you create a multiline echo or assignment?You can use \' or \" to escape either a single or double quote.

          

  23. Static VariablesAre never reset and are only within the scope of the function. You cannot assign the result of an expression in their definitions.