NAME

Question types


Start with


Question limit

of 23 available terms

Print test

23 Matching questions

  1. What can a variable store?
  2. What is the difference between ++$j and $j++?
  3. Can you redefine a constant?
  4. Static Variables
  5. What is the purpose of functions?
  6. Superglobal variables,
  7. How do you escape a quotation mark?
  8. Which character must be placed at the end of every PHP statement?
  9. Why do you suppose an underscore is allowed in variable names (e.g., $current_user) whereas hyphens are not (e.g., $current-user)?
  10. How do you convert one variable type to another (say, a string to a number)?
  11. What is the result of combining a string with a number?
  12. Which symbol is used to preface all PHP variables?
  13. Using the htmlentities is important because...
  14. Are the operators && and and interchangeable?
  15. What tag is used to cause PHP to start interpreting program code? And what is the short form of the tag?
  16. Are variable names case-sensitive?
  17. What is the difference between the echo and print commands?
  18. What are the two types of comment tags?
  19. How can you create a multiline echo or assignment?
  20. If you generate data within a function, what are a couple of ways to convey the data to the rest of the program?
  21. What is the difference between $variable = 1 and $variable == 1?
  22. How can you make a variable accessible to all parts of a PHP program?
  23. Can you use spaces in variable names?
  1. a You can use // for a single-line comment or / ... / to span multiple lines.
  2. b 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.
  3. c 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.
  4. d $variable = 1 is an assignment statement, whereas $variable == 1 is a comparison operator. Use $variable = 1 to set the value of $variable. Use $variable == 1 to find out later in the program whether $variable equals 1. If you mistakenly use $variable = 1 where you meant to do a comparison, it will do two things you probably don't want: set $variable to 1 and return a true value all the time, no matter what its previous value was.
  5. e Are never reset and are only within the scope of the function. You cannot assign the result of an expression in their definitions.
  6. f You cannot use spaces in variable names, as this would confuse the PHP parser. Instead, try using the _ (underscore).
  7. g When you combine a string with a number, the result is another string.
  8. h Variables hold a value that can be a string, a number, or other data.
  9. i If you generate data within a function, you can convey the data to the rest of the program by returning a value or modifying a global variable.
  10. j With the exception of constants, all PHP variables must begin with $.
  11. k 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.
  12. l 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.
  13. m Variable names are case-sensitive. So, for example,$This_Variable is not the same as $this_variable.
  14. n There is no difference between ++$j and $j++ unless the value of $j is being tested, assigned to another variable, or passed as a parameter to a function. In such cases, ++$j increments $j before the test or other operation is performed, whereas $j++ performs the operation and then increments $j.
  15. o The tag used to start PHP interpreting code is <?php ... ?>, which can be shortened to <? ... ?> but is not recommended practice.
  16. p All PHP statements must end with a semicolon (;).
  17. q To convert one variable type to another, reference it and PHP will automatically convert it for you.
  18. r They are provided by the PHP environment but are global within the program, accessible absolutely everywhere. All of the superglobals (except for $GLOBALS) are named with a single initial underscore and only capital letters;
  19. s You cannot redefine constants because, by definition, once defined they retain their value until the program terminates.
  20. t You can make a variable accessible to all parts of a PHP program by declaring it as global.
  21. u You can use \' or \" to escape either a single or double quote.
  22. v 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.
  23. w 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.