Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
5 Cards in this Set
- Front
- Back
What is the difference between echo() and print()?
|
Echo is not actually a function, but a language construct; thus you don't need to use parentheses. No value is returned.
Print is also a language construct, but always returns a value of 1. |
|
What tags can be used to shortcut echo()?
|
<?= expression ?> This is a shortcut for "<? echo expression ?>"
<%= $variable; # This is a shortcut for "<% echo . . ." %> NOTE: It is possible to have both styles of shortcut tags disabled in PHP.ini, so they are not recommend. |
|
How can you get the variable type for a variable?
|
gettype()
GetType($var1) will return the human readable form (integer, float, string, etc) of the variable. Also... var_dump() Will return type and number Example: <?php $b = 3.1; $c = true; var_dump($b, $c); ?> Returns: float(3.1) bool(true) |
|
What is the difference between a type-cast and using the SetType() function?
|
Using a type-cast will temporary convert the var to the new type for that expression, but not change var type. SetType() will actually change the var type.
Example: $b = 0; echo var_dump((bool)$b); echo var_dump($b); settype($b, "bool"); echo var_dump($b); Returns: bool(false) int(0) bool(false) |
|
What does the print_r() function do?
|
Prints human readable information about a variable.
print_r($var); or $results = print_r($var1, true); //Returns data to var $results |