This is the first part of the explanation exam questions to test Zend PHP5 with the correct (imho) answers and useful links on manuals.
If you have additional thoughts please use comments.
1. Which of the following tags are an acceptable way to begin a PHP Code block? (Choose 4 answers)
- <SCRIPT LANGUAGE=»php»>
- <!
- <%
- <?php
- <?
Answer: A, C, D, E
http://php.net/manual/en/language.basic-syntax.phpmode.php
2. Which of the following are valid PHP variables? (Choose 4 answers)
- @$foo
- &$variable
- ${0×0}
- $variable
- $0×0
Answer: A, B, C, D
http://php.net/manual/en/language.variables.php
3. What is the best way to iterate and modify every element of an array using PHP 5? (Choose 1 answer)
- You cannot modify an array during iteration
- for($i = 0; $i < count($array); $i++) { /* … */ }
- foreach($array as $key => &$val) { /* … */ }
- foreach($array as $key => $val) { /* … */ }
- while(list($key, $val) = each($array)) { /* … */
Answer: C
http://php.net/manual/en/control-structures.foreach.php: As of PHP 5, you can easily modify array's elements by preceding $value with &. This will assign reference instead of copying the value.
4. What is the output of the following PHP code? (Choose 1 answer)
<?php
define('FOO', 10);
$array = array(10 => FOO, "FOO" => 20);
print $array[$array[FOO]] * $array["FOO"];
?>
- FOO
- 100
- 200
- 20
- 10
Answer: C
http://www.php.net/manual/en/function.define.php, http://php.net/manual/en/language.constants.php, FOO is constant, but “FOO” is string
5. What is the output of the following PHP script? (Choose 1 answer)
<?php
$a = 1;
$b = 2.5;
$c = 0xFF;
$d = $b + $c;
$e = $d * $b;
$f = ($d + $e) % $a;
print ($f + $e);
?>
- 643.75
- 432
- 643
- 257
- 432.75
Answer: A
http://en.wikipedia.org/wiki/Hexadecimal, http://www.php.net/manual/en/language.operators.arithmetic.php
6. What combination of boolean values for $a, $b, $c, and $d will result in the variable $number being equal to 3? (Choose 1 answer)
<?php
$a = null;
$b = null;
$c = null;
$d = null;
if($a && !$b) {
if(!!$c && !$d) {
if($d && ($a || $c)) {
if(!$d && $b) {
$number = 1;
} else {
$number = 2;
}
} else {
$number = 3;
}
} else {
$number = 4;
}
} else {
$number = 5;
}
?>
- false, true, true, true
- true, false, true, false
- true, true, false, false
- false, true, true, false
- false, false, true, false
Answer: B
http://www.php.net/manual/en/language.operators.logical.php : $a && $b – And – TRUE if both $a and $b are TRUE -> ($a && !$b) TRUE then $a is TRUE and $b is FALSE.
7. What is the output of the following code? (Choose 1 answer)
<?php
$string = "111221";
for($i = 0; $i < strlen($string); $i++) {
$current = $string[$i];
$count = 1;
while(isset($string[$i + $count]) && ($string[$i + $count] == $current)) $count++;
$newstring .= "$count{$current}";
$i += $count-1;
}
print $newstring;
?>
- 312211
- 3312212
- 11221221
- 221131
- 3211122
Answer: A
Just executing while loop once you will get the answer.
8. What is the best way to ensure that a user-defined function is always passed an object as its single parameter? (Choose 1 answer)
- function myfunction(stdClass $a)
- function myfunciton($a = stdClass)
- Use is_object() within the function
- There is no way to ensure the parameter will be an object
- function myfunction(Object $a)
Answer: C
http://php.net/manual/en/function.is-object.php
9. What does the following function do, when passed two integer values for $p and $q? (Choose 1 answer)
<?php
function magic($p, $q) {
return ($q == 0) ? $p : magic($q, $p % $q);
}
?>
- Loops infinitely
- Switches the values of $p and $q
- Determines if they are both even or odd
- Determines the greatest common divisor between them
- Calculates the modulus between the two
Answer: D
10. The ____ operator is used to test if two values are identical in every way. (Choose 1 answer)
- !==
- instanceof
- =
- ==
- ===
Answer: E
http://www.php.net/manual/en/language.operators.comparison.php
11. What would go in place of ?????? below to make this script execute without a fatal error? (Choose 3 answers)
- quit();
- die();
- stop();
- __halt_compiler();
- exit();
Answer: B, D, E
http://ru.php.net/manual/en/function.die.php, http://php.net/manual/en/function.halt-compiler.php, http://ru.php.net/manual/en/function.exit.php
12. What is the output of the following? (Choose 1 answer)
<?php
$a = 010;
$b = 0xA;
$c = 2;
print $a + $b + $c;
?>
- 20
- 22
- 18
- $a is an invalid value
- 2
Answer: A
http://en.wikipedia.org/wiki/Octal, http://en.wikipedia.org/wiki/Hexadecimal
13. What is the output of the following? (Choose 1 answer)
<?php
$a = 20;
function myfunction($b) {
$a = 30;
global $a, $c;
return $c = ($b + $a);
}
print myfunction(40) + $c;
?>
- 120
- Syntax Error
- 60
- 70
Answer: A
http://php.net/manual/en/language.variables.scope.php
14. What would you replace ??????? with, below, to make the string Hello, World! be displayed? (Choose 1 answer)
<?php
function myfunction() {
???????
print $string;
}
myfunction("Hello, World!");
?>
- There is no way to do this
- $string = $argv[1];
- $string = $_ARGV[0];
- list($string) = func_get_args();
- $string = get_function_args()
Answer:D
http://ru.php.net/manual/en/function.func-get-args.php
15. What is the output of the following function? (Choose 1 answer)
<?php
function &find_variable(&$one, &$two, &$three) {
if($one > 10 && $one < 20) return $one;
if($two > 10 && $two < 20) return $two;
if($three > 10 && $three < 20) return $three;
}
$one = 2;
$two = 20;
$three = 15;
$var = &find_variable($one, $two, $three);
$var++;
print "1: $one, 2: $two, 3: $three";
?>
- 1: 2, 2: 20, 3: 15
- 1: 3, 2:21, 3:16
- 1: 2, 2:21, 3:15
- 1: 3, 2: 20, 3: 15
- 1: 2, 2: 20, 3: 16
Answer: E
http://www.php.net/manual/en/functions.returning-values.php, http://www.php.net/manual/en/language.references.return.php
http://www.php.net/manual/en/language.references.pass.php
16. For an arbitrary string $mystring, which of the following checks will correctly determine if the string PHP exists within it? (Choose 1 answer)
- if(strpos($mystring, «PHP») !== false)
- if(!strpos($mystring,»PHP»))
- if(strpos($mystring, «PHP») === true)
- if(strloc($mystring, «PHP») == true)
- if(strloc($mystring, «PHP») === false)
Answer: A
http://php.net/manual/en/function.strpos.php: This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE, such as 0 or «».
http://www.php.net/manual/en/language.types.boolean.php
http://www.php.net/manual/en/language.operators.comparison.php
17. What are the values of $a in $obj_one and $obj_two when this script is executed? (Choose 1 answer)
<?php
class myClass {
private $a;
public function __construct() {
$this->a = 10;
}
public function printValue() {
print "The Value is: {$this->a}\n";
}
public function changeValue($val, $obj = null) {
if(is_null($obj)) {
$this->a = $val;
} else {
$obj->a = $val;
}
}
public function getValue() {
return $this->a;
}
}
$obj_one = new myClass();
$obj_two = new myClass();
$obj_one->changeValue(20, $obj_two);
$obj_two->changeValue($obj_two->getValue(), $obj_one);
$obj_two->printValue();
$obj_one->printValue();
?>
- 10,20
- You cannot modify private member variables of a different class
- 20,20
- 10,10
- 20,10
Answer: C
http://php.net/manual/en/language.oop5.visibility.php
http://php.net/manual/en/language.oop5.references.php
18. What are the three access modifiers that you can use in PHP objects? (Choose 3 answers)
- protected
- public
- static
- private
- final
Answer: A, B, D
http://php.net/manual/en/language.oop5.visibility.php
19. When checking to see if two variables contain the same instance of an object, which of the following comparisons should be used? (Choose 1 answer)
- if($obj1->equals($obj2) && ($obj1 instanceof $obj2))
- if($obj1->equals($obj2))
- if($obj1 === $obj2)
- if($obj1 instance of $obj2)
- if($obj1 == $obj2)
Answer: D
http://php.net/manual/en/internals2.opcodes.instanceof.php, http://php.net/manual/en/language.operators.type.php
20. In PHP 5 you can use the ______ operator to ensure that an object is of a particular type. You can also use_______ in the function declaration. (Choose 1 answer)
- instanceof, is_a
- instanceof, type-hinting
- type, instanceof
- ===, type-hinting
- ===, is_a
Answer: B
http://php.net/manual/en/internals2.opcodes.instanceof.php, http://php.net/manual/en/language.oop5.typehinting.php
21. What is wrong with the following code? (Choose 1 answer)
<?php
function duplicate($obj) {
$newObj = $obj;
return $newObj;
}
$a = new MyClass();
$a_copy = duplicate($a);
$a->setValue(10);
$a_copy->setValue(20);
?>
- You must use return &$newObj instead
- There is nothing wrong with this code
- duplicate() must accept its parameter by reference
- You must use the clone operator to make a copy of an object
- duplicate() must return a reference
Answer: D
http://php.net/manual/en/language.oop5.cloning.php
22. How can you modify the copy of an object during a clone operation? (Choose 1 answer)
- Put the logic in the object's constructor to alter the values
- Implment your own function to do object copying
- Implement the object's __clone() method
- Implement __get() and __set() methods with the correct logic
- Implement the __copy() method with the correct logic
Answer: C
http://php.net/manual/en/language.oop5.cloning.php
23. What is the primary difference between a method declared as static and a normal method? (Choose 1 answer)
- Static methods can only be called using the :: syntax and never from an instance
- Static methods do not provide a reference to $this
- Static methods cannot be called from within class instances
- Static methods don't have access to the self keyword
- There is no functional difference between a static and non-static method
Answer: A
http://php.net/manual/en/language.oop5.static.php: “Declaring class properties or methods as static makes them accessible without needing an instantiation of the class.” looks more primary then “Because static methods are callable without an instance of the object created, the pseudo-variable $this is not available inside the method declared as static.”.
24. What is the output of the following script? (Choose 1 answer)
<?php
class ClassOne {
protected $a = 10;
public function changeValue($b) {
$this->a = $b;
}
}
class ClassTwo extends ClassOne {
protected $b = 10;
public function changeValue($b) {
$this->b = 10;
parent::changeValue($this->a + $this->b);
}
public function displayValues() {
print "a: {$this->a}, b: {$this->b}\n";
}
}
$obj = new ClassTwo();
$obj->changeValue(20);
$obj->changeValue(10);
$obj->displayValues();
?>
- a: 30, b: 30
- a: 30, b: 20
- a: 30, b: 10
- a: 20, b: 20
- a: 10, b: 10
Answer: C
http://php.net/manual/en/language.oop5.visibility.php
25. The ______ keyword is used to indicate an incomplete class or method, which must be further extended and/or implemented in order to be used. (Choose 1 answer)
- final
- protected
- incomplete
- abstract
- implements
Answer: D
http://php.net/manual/en/language.oop5.abstract.php
26. To ensure that a given object has a particular set of methods, you must provide a method list in the form of an________ and then attach it as part of your class using the ________ keyword. (Choose 1 answer)
- array, interface
- interface, implements
- interface, extends
- instance, implements
- access-list, instance
Answer: B
http://php.net/manual/en/language.oop5.interfaces.php
27. Type-hinting and the instanceof keyword can be used to check what types of things about variables? (Choose 3 answers)
- If a particular child class extends from it
- If they are an instance of a particular interface
- If they are an abstract class
- If they have a particular parent class
- If they are an instance of a particular class
Answer: B, D, E
http://php.net/manual/en/language.operators.type.php: Example #4, Example #2, Example #1 respectively
28. In PHP 5's object model, a class can have multiple ______ but only a single direct. (Choose 1 answer)
- None of the above
- interfaces, child
- children, interface
- interfaces, parent
- parents, interface
Answer: D
http://php.net/manual/en/language.oop5.interfaces.php: Example #3 Multiple interface inheritance, http://php.net/manual/en/keyword.extends.php: An extended class is always dependent on a single base class, that is, multiple inheritance is not supported.
29. What three special methods can be used to perform special logic in the event a particular accessed method or member variable is not found? (Choose 3 answers)
- __get($variable)
- __call($method, $params)
- __get($method)
- __set($variable, $value)
- __call($method)
Answer: A, B, D
http://php.net/manual/en/language.oop5.overloading.php
30. The _______ method will be called automatically when an object is represented as a string. (Choose 1 answer)
- getString()
- __get()
- __value()
- __toString()
- __getString()
Answer: D
http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring
31. When an object is serialized, which method will be called, automatically, providing your object with an opportunity to close any resources or otherwise prepare to be serialized? (Choose 1 answer)
- __destroy()
- __serialize()
- __destruct()
- __shutdown()
- __sleep()
Answer: E
http://php.net/manual/en/function.serialize.php
32. What is the output of the following code? (Choose 1 answer)
<?php
class MyException extends Exception {}
class AnotherException extends MyException {}
class Foo {
public function something() {
throw new AnotherException();
}
public function somethingElse() {
throw new MyException();
}
}
$a = new Foo();
try {
try {
$a->something();
} catch(AnotherException $e) {
$a->somethingElse();
} catch(MyException $e) {
print "Caught Exception";
}
} catch(Exception $e) {
print "Didn't catch the Exception!";
}
?>
- «Caught Exception» followed by «Didn't catch the Exception!»
- A fatal error for an uncaught exception
- «Didn't catch the Exception!»
- «Didn't catch the Exception!» followed by a fatal error
- «Caught Exception»
Answer: C
http://php.net/manual/en/language.exceptions.php, http://stackoverflow.com/questions/2586608/confused-by-this-php-exception-try-catch-nesting
33. Which two internal PHP interfaces provide functionality which allow you to treat an object like an array? (Choose 2 answers)
- iteration
- arrayaccess
- objectarray
- iterator
- array
Answer: B, D
http://php.net/manual/en/class.arrayaccess.php, http://php.net/manual/en/class.iterator.php
34. Which php.ini directive should be disabled to prevent the execution of a remote PHP script via an include or require construct? (Choose 1 answer)
- You cannot disable remote PHP script execution
- curl.enabled
- allow_remote_url
- allow_url_fopen
- allow_require
Answer: D
http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
35. When attempting to prevent a cross-site scripting attack, which of the following is most important? (Choose 1 answer)
- Not writing Javascript on the fly using PHP
- Filtering Output used in form data
- Filtering Output used in database transactions
- Writing careful Javascript
- Filtering all input
Answer: E
36. Which of the following php.ini directives should be disabled to improve the outward security of your application? (Choose 4 answers)
- safe_mode
- magic_quotes_gpc
- register_globals
- display_errors
- allow_url_fopen
Answer: B, C, D, E
http://php.net/manual/en/features.safe-mode.php
37. Which of the following list of potential data sources should be considered trusted? (Choose 1 answer)
- None of the above
- $_ENV
- $_GET
- $_COOKIE
- $_SERVER
Answer: A
38. What is the best way to ensure the distinction between filtered / trusted and unfiltered / untrusted data? (Choose 1 answer)
- None of the above
- Never trust any data from the user
- Enable built-in security features such as magic_quotes_gpc and safe_mode
- Always filter all incoming data
- Use PHP 5's tainted mode
Answer: D
http://devzone.zend.com/article/1113
39. Consider the following code, what potential security hole would this code snippet produce: (Choose 1 answer)
<?php
session_start();
if(!empty($_REQUEST['id']) && !empty($_REQUEST['quantity'])) {
$id = scrub_id($_REQUEST['id']);
$quantity = scrub_quantity($_REQUEST['quantity'])
$_SESSION['cart'][] = array('id' => $id, 'quantity' => $quantity)
}
/* .... */
?>
- Cross-Site Scripting Attack
- There is no security hole in this code
- Code Injection
- SQL Injection
- Cross-Site Request Forgery
Answer: E
http://en.wikipedia.org/wiki/Cross-site_request_forgery
40. What is the best measure one can take to prevent a cross-site request forgery? (Choose 1 answer)
- Disallow requests from outside hosts
- Add a secret token to all form submissions
- Turn off allow_url_fopen in php.ini
- Filter all output
- Filter all input
Answer:B
http://en.wikipedia.org/wiki/Cross-site_request_forgery#Prevention
41. Consider the following code, which of the following values of $_GET['url'] would cause session fixation? (Choose 1 answer)
<?php
header("Location: {$_GET['url']}");
?>
- Session Fixation is not possible with this code snippet
- http://www.zend.com/?PHPSESSID=123
- PHPSESSID%611243
- Set-Cookie%3A+PHPSESSID%611234
- http%3A%2F%2Fwww.zend.com%2F%0D%0ASet-Cookie%3A+PHPSESSID%611234
Answer: B
http://www.php.net/manual/en/session.idpassing.php
42. When implementing a permissions system for your Web site, what should always be done with regards to the session? (Choose 1 answer)
- None of the above
- You should not implement permission systems using sessions
- Sessions should be cleared of all data and re-populated
- The session key should be regenerated
- The session should be destroyed
Answer: D
http://www.php.net/manual/en/function.session-regenerate-id.php
43. Which of the following is not valid syntax for creating a new array key? (Choose 1 answer)
- $a[] = «value»;
- $a{} = «value»;
- $a[0] = «value»;
- $a{0} = «value»;
- $a[$b = 0] = «value»;
Answer: B
http://php.net/manual/en/language.types.array.php
44. Which of the following functions will sort an array in ascending order by value, while preserving key associations? (Choose 1 answer)
- asort()
- usort()
- krsort()
- ksort()
- sort()
Answer: A
http://php.net/manual/en/function.asort.php — sort an array and maintain index association.
45. What is the output of the following code block? (Choose 1 answer)
<?php
$a = "The quick brown fox jumped over the lazy dog.";
$b = array_map("strtoupper", explode(" ", $a));
foreach($b as $value) {
print "$value ";
}
?>
- THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.
- A PHP Error
- Array Array Array Array Array Array Array Array Array
Answer: A
http://php.net/manual/en/function.array-map.php
46. Which from the following list is not an appropriate use of an array? (Choose 1 answer)
- As a list
- All of these uses are valid
- As a Lookup Table
- A Stack
- As a hash table
Answer: B
http://php.net/manual/en/language.types.array.php: This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more.
47. What is the output of this code snippet? (Choose 1 answer)
<?php
$a = array(0.001 => 'b', .1 => 'c');
print_r($a);
?>
- An empty array
- 0.001 => 'b', .1 => c
- 0 => 'c'
- '0.001' => 'b', '0.1' => c'
- A Syntax Error
Answer: C
http://php.net/manual/en/language.types.array.php :Floats in key are truncated to integer.
48. Which of the following functions could be used to break a string into an array? (Choose 3 answers)
- array_split()
- split()
- string_split()
- preg_match_all()
- explode()
Answer: B, D, E
http://ru.php.net/manual/en/function.split.php, http://ru.php.net/manual/en/function.preg-match-all.php, http://ru.php.net/manual/en/function.explode.php
49. If you wanted a variable containing the letters A through Z, that allowed you to access each letter independently, which of the following approaches could you use? (Choose 3 answers)
- $str = «ABCDEFGHIJKLMNOPQRSTUVWXYZ»;
- range('A', 'Z');
- explode(«», «ABCDEFGHIJKLMNOPQRSTUVWXYZ»);
- You would use the ALPHA_ARRAY constant
- None of the above
Answer: A, B, C (but C is error in mock test, see manual about delimeter)
http://ru.php.net/manual/en/function.range.php, http://ru.php.net/manual/en/function.explode.php (Warning: explode(): Empty delimiter.)
50. What is the output of the following code block? (Choose 1 answer)
<?php
$array = array(1 => 0, 2, 3, 4);
array_splice($array, 3, count($array), array_merge(array('x'), array_slice($array, 3)));
print_r($array);
?>
- 1 => 1, 2 => 2, 3 => x, 4=> 4
- 0 => 1, 2 => 2, 3 => 3, 4 => 4, x => 3
- 0 => 0, 1=> 2, 2 => 3, 3 => x, 4 => 4
- 0 => x, 1 => 0, 2 => 1, 3=> 2, 4=>3
- 1 => 1, 3 => x, 2 => 2, 4 => 4
Answer: C
http://ru.php.net/manual/en/function.array-slice.php, http://ru.php.net/manual/en/function.array-merge.php, http://ru.php.net/manual/en/function.array-splice.php
51. Which function would you use to add an element to the beginning of an array? (Choose 1 answer)
- array_shift()
- array_push();
- $array[0] = «value»;
- array_unshift()
- array_pop();
Answer: D
http://ru.php.net/manual/en/function.array-unshift.php
52. Which key will not be displayed from the following code block? (Choose 1 answer)
<?php
$array = array('a' => 'John',
'b' => 'Coggeshall',
'c' => array('d' => 'John',
'e' => 'Smith'));
function display($item, $key) {
print "$key => $item\n";
}
array_walk_recursive($array, "display");
?>
- d
- c
- b
- a
- They all will be displayed
Answer: B
http://ru.php.net/manual/en/function.array-walk-recursive.php
53. What is the result of the following code snippet? (Choose 1 answer)
<?php
$array = array('a' => 'John',
'b' => 'Coggeshall',
'c' => array('d' => 'John',
'e' => 'Smith'));
function something($array) {
extract($array);
return $c['e'];
}
print something($array);
?>
- Smith
- A PHP Warning
- Coggeshall
- NULL
- Array
Answer: A
http://ru.php.net/manual/en/function.extract.php
54. What should go in the missing line ????? below to produce the output shown? (Choose 1 answer)
<?php
$array_one = array(1,2,3,4,5);
$array_two = array('A', 'B', 'C', 'D', 'E');
???????
print_r($array_three);
?>
Result:
Array
(
[5] => A
[4] => B
[3] => C
[2] => D
[1] => E
)
- $array_three = array_merge(array_reverse($array_one), $array_two);
- $array_three = array_combine($array_one, $array_two);
- $array_three = array_combine(array_reverse($array_one), $array_two);
- $array_three = array_merge($array_one, $array_two);
- $array_three = array_reverse($array_one) + $array_two;
Answer: C
http://ru.php.net/manual/en/function.array-combine.php, http://ru.php.net/manual/en/function.array-reverse.php
55. Which of the following functions are used with the internal array pointer to accomplish an action? (Choose 4 answers)
- key
- forward
- prev
- current
- next
Answer: A, C, D, E
http://php.net/manual/en/function.key.php, http://php.net/manual/en/function.prev.php, http://php.net/manual/en/function.current.php, http://php.net/manual/en/function.next.php
56. Given the following array, the fastest way to determine the total number a particular value appears in the array is to use which function: (Choose 1 answer)
$array = array(1,1,2,3,4,4,5,6,6,6,6,3,2,2,2);
- array_total_values
- array_count_values
- A foreach loop
- count
- a for loop
Answer: B
http://ru.php.net/manual/en/function.array-count-values.php
57. The ____ construct is particularly useful to assign your own variable names to values within an array. (Choose 1 answer)
- array_get_variables
- current
- each
- import_variables
- list
Answer: E
http://ru.php.net/manual/en/function.list.php
58. The following code snippet displays what for the resultant array? (Choose 1 answer)
<?php
$a = array(1 => 0, 3 => 2, 4 => 6);
$b = array(3 => 1, 4 => 3, 6 => 4);
print_r(array_intersect($a, $b));
?>
- 1 => 0
- 1 => 3, 3 => 1, 4 => 3
- 3 => 1, 3=> 2, 4 => 3, 4=> 6
- 1 => 0, 3 => 2, 4 => 6
- An empty Array
http://ru.php.net/manual/en/function.array-intersect.php
59. Which of the following are not valid ways to embed a variable into a string? (Choose 1 answer)
- $a = «Value: $value->getValue()»;
- $a = «Value: {$value}»;
- $a = 'Value: $value';
- $a = «Value: $value»;
- $a = «Value: {$value['val']}»;
Answer: A, C
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double
60. What variable reference would go in the spots indcated by ????? in the code segment below? (Choose 1 answer)
<?php
$msg = "The Quick Brown Foxed Jumped Over the Lazy Dog";
$state = true;
$retval = "";
for($i = 0; (isset(??????)); $i++) {
if($state) {
$retval .= strtolower(?????);
} else {
$retval .= strtoupper(?????);
}
$state = !$state;
}
print $retval;
?>
- $msg{$i}
- ord($msg);
- chr($msg);
- substr($msg, $i, 2);
Answer: A
http://ru.php.net/manual/en/function.isset.php
Вопрос №19: Какой код надо использовать, чтобы удостовериться, что две переменные ссылаются на один и тот же объект. Правильный ответ С. Приведенный совет служит для проверки принадлежности объекта к определенному классу/интерфейсу.
23. What is the primary difference between a method declared as static and a normal method?
Ответ А с натяжкой можно было бы считать правдой, если бы не вторая часть предложения. Статический метод легко вызывается из объектного метода, например через self::, если оба метода находятся в одном классе.
Правильный ответ B.
Малдер, просто Спасибо!
Hello,
I have found a web site that contain several answer and php training test
http://www.php-certifications.com
It covers all categorys of the Zend PHP 5.3 Certification :
PHP Bases
Streams and Network Programming
Databases and SQL
XML and Web Services
Object Oriented Programming
Security
Strings and Patterns
Web Features
PHP 4/5 Differences
Functions
Arrays
Design and Theory