Questions
In PHP, arrays may be sorted with which of the following functions?
- uksort()
- arsort()
- ksort()
- All of the above
PHP comments for a single line have the following syntax:
- /* comments /*
- #
- //
- ::
- A&B
Which of the following functions are used by PHP to find out what type a variable is?
- gettype()
- is_double()
- get_type()
- is_date()
- A&B
The three possible connection states in PHP are ________.
- normal
- aborted
- timeout
- All of the above
In PHP, the error control operator is ________.
- *
- %
- @
- &
In PHP, instructions are terminated with a _______.
- ;
- #
- !
- %>
What does PHP stand for?
- PHP: Hypertext Preprocessor
- Personal Home Page
- Private Home Page
- Personal Hypertext Processor
PHP server scripts are surrounded by delimiters, which?
- <?php>...</?>
- <?php…?>
- <script>...</script>
- <&>...</&>
How do you write "Hello World" in PHP
- "Hello World";
- echo "Hello World";
- Document.Write("Hello World");
- response.write("Hello World")
All variables in PHP start with which symbol?
- !
- $
- &
- #
A constructor is a special kind of…
- Class
- Method
- Object
- Variable
What can you use to replace like with hate in I like Eminem?
- preg_replace("like", "hate", "I like Eminem")
- preg_replace("/like/", "hate", "I like Eminem")
- preg_replace("/like/", "/hate/", "I like Eminem")
- preg_replace("hate", "like", "I like Eminem")
What library do you need in order to process images?
- c-client library
- GIF/PNG library
- Image Library
- GD library
What is the problem with <?=$expression ?> ?
- It requires short tags and this is not compatible with XML
- There is no problem
- This syntax doesn't even exist It requires a special PHP library that may not always be available
What does break; do?
- Ends execution of the current switch structure
- Moves on to the next iteration of the current for, foreach, while, do-while or switch structure
- Ends execution of the current for, foreach, while, do-while or switch structure
Can this PHP code be valid: $4bears = $bears->getFirst4();
- Yes
- No
Assuming all the variables a, b, c have already been defined, could this be a variable name: ${$a}[$b][$c] ?
- Yes
- No
Put this line php display_errors=false in a .htaccess file when you deploy the application?
- That won't hide any error 'coz you can't use .htaccess to control the PHP engine Bad idea, I want to see when errors occur
- That won't hide any error 'coz it's not the correct code
- Good idea, increases security
What does this function do:
<?php
function my_func($variable) {
return (is_numeric($variable) && $variable % 2 == 0);
}
?>
- tests whether $variable is a number and ends in 2
- tests whether $variable ends in 2
- tests whether $variable is a number and contains 2
- tests whether $variable is an even number