PHP Test
Does PHP 5 support exceptions?
For the following code: <?php function Expenses() { function Salary() { } function Loan() { function Balance() { } } } ?> Which of the following s...
What enctype is required for file uploads to work?
What function should you use to join array elements with a glue string?
What is the best practice for running MySQL queries in PHP? Consider the risk of SQL injection.
What is the best way to change the key without changing the value of a PHP array element?
What is the correct line to use within the php.ini file, to specify that 128MB would be the maximum amount of memory that a script may use?
What is the correct way to send a SMTP (Simple Mail Transfer Protocol) email using PHP?
What is the string concatenation operator in PHP?
What will be the output of the following code? <? echo 5 * 6 / 2 + 2 * 3; ?>
What will be the output of the following code? <?php var_dump (3*4); ?>
What would occur if a fatal error was thrown in your PHP program?
Which function can be used to delete a file?
Which of the following characters are taken care of by htmlspecialchars?
Which of the following is correct about Mysqli and PDO?
Which of the following is incorrect with respect to separating PHP code and HTML?
Which of the following is not a file-related function in PHP?
Which of the following is not a PHP magic constant?
Which of the following is true about the singleton design pattern?
Which of the following is used to maintain the value of a variable over different pages?
Which of the following is useful for method overloading?
Which of the following methods should be used for sending an email using the variables $to, $subject, and $body?
Which of the following variable declarations within a class is invalid in PHP?
Which of the following will check if a function exists?
Which of the following will print out the PHP call stack?
Which of the following will read an object into an array variable?
Which of the following will start a session?
Which of the following will store order number (34) in an 'OrderCookie'?
Which one of the following is not an encryption method in PHP?
Given the following array: $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red'); Which one of the following will print 2?

What is the output of the following code?

<?php
echo 0x500;
?>
Which function will suitably replace 'X' if the size of a file needs to be checked? $size=X(filename);
Which of the following is the correct way to check if a session has already been started?
Which of the following cryptographic functions in PHP returns the longest hash value?
Which of the following is not a valid API?
What is the difference between the float and the double type in PHP?

What is wrong with the following code?

<?php
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
Which of the the following are PHP file upload-related functions?
Without introducing a non-class member variable, which of the following can be used to keep an eye on the existing number of objects of a given class?
What is the correct PHP command to use to catch any error messages within the code?

What will be the output of the following code?

<?php
var_dump (3*4);
?>
What is the correct syntax of mail() function in PHP?
Which of the following methods is used to check if an array is associative or numeric?

What will be the output of the following code?

<?
$a = 3;
print '$a';
?>
Which of these is not a valid SimpleXML Parser method?
Consider the following class: 1 class Insurance 2 { 3 function clsName() 4 { 5 echo get_class($this); 6 } 7 } 8 $cl = new Insurance(); 9 $cl->clsName(); 10 Insurance::clsName(); Which of the following lines should be commented to print the class name without errors?
What is the meaning of the system message, "Allowed memory size of <number> bytes exhausted"?
Should assert() be used to check user input?
Which of the following functions is not used in debugging?

What will be the output of the following code?

<?
$foo = 5 + "10 things";
print $foo;
?>
Which of the following environment variables is used to fetch the IP address of the user in a PHP application?
Which of the following is true about posting data using cURL in PHP?
Which of the following regular expressions can be used to check the validity of an e-mail addresss?
Which of the following is not a predefined constant?

What is the output of the following code?

<?php
  function abc()
  {
    return __FUNCTION__;
  }
  function xyz()
  {
    return abc();
  }
  echo xyz();
?>
Which of the following file modes is used to write into a file at the end of the existing content, and create the file if the file does not exist?
What is the difference between die() and exit() in PHP?
Which of the following is not a valid DOM method in PHP?

What will be the output of the following code?

<?php
$str="Hello";

$test="lo";

echo substr_compare($str, $test, -strlen($test), strlen($test)) === 0;

?>

What would be the output of the following code?

<?php
$arr = array("foo",
             "bar",
             "baz");
for ($i = 0; $i < count($arr); $i++) { 
  $item = $arr[$i]; 
}
echo "<pre>";
print_r($item);
echo "</pre>";
?>
Which of the following will produce a value of "83" as its output?
What is the best way to load a file that contains necessary functions and classes?

What will be the output of the following code?

<?php
echo 30 * 5 . 7;
?>
Which of the following is false about cURL?

What is the output of the following code?

<?php
  $array = array("1","2","3","4");
  $variable = end(array_keys($array));
  echo $variable;  
?>
Which of the following are not considered Boolean false?
What is the fastest way to insert an item $item into the specified position $position of the array $array?

What will be the output of the following code?

<?
$a = (1 << 0);
$b = (1 << 1);

echo ($b | $a) << 2 ;
?>
With regards to the "static" keyword in PHP, which of the following statements is false?
What will be the output of the following code? class Person { protected $name; public function __construct($name) { $this->name = $name; } public function getName() { return $this->name; } } $person = new Person("Foo"); echo $person->getName();
Which of the following printing construct/function accepts multiple parameters?
What will be the output of the following code? $var = 10; function fn() { $var = 20; return $var; } fn(); echo $var;
Which of the following is not a valid php.ini parameter with respect to file uploading?
Which of the following is true regarding the str_replace() function in PHP?
Which of the following is not a valid Xdebug configuration setting?
What is "empty()"?
Which of the following statements is incorrect?
Which of the following is not related to debugging in PHP?

What will be the output of the following code?

<?php
$a = (1 << 0);
$b = (1 << $a);
$c = (1 << $b);

echo ($c || $b) << 2 * $a | $a;
?>

What is the output of the following code?

<?php

function
vec_add (&$a, $b)
{
    $a['x'] += $b['x'];
    $a['y'] += $b['y'];
    $a['z'] += $b['z'];
}

$a = array (x => 3, y => 2, z => 5);
$b = array (x => 9, y => 3, z => -7);

vec_add (&$a, $b);

print_r ($a);

?>
Which of the following will not return an array containing all normal Latin alphabet characters (A-Z)?
Which of these is not a valid PHP XML API?
Which line would move the internal pointer to the end of an array?
If you are given two dates in this form: Start Date: 2007-03-24 End Date: 2009-06-26 Which code snippet finds the difference between these two in the following form: 2 years, 3 months and 2 days PHP > 5.3
What is the difference between $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']?
Which of the following is a ternary operator?

What is the output of the following PHP code snippet?

<?php

$var = "testing module";
$statement = 'This is a $var';
echo ($statement);

?>
What is the difference between $a == $b and $a === $b in PHP?
When comparing two arrays, what is the difference between "==" and "==="?
Which of the following variables are supported by the 'str_replace()' function?
Which of the following is not a valid cURL parameter in PHP?
Which of the following is the right MIME to use as a Content Type for JSON data?

What is the output of the following code?

<?php
  echo "<pre>";
  $array = array("red","green","blue");
  $last_key = end(array_keys($array));
  foreach ($array as $key => $value) {
      if ($key == $last_key) {
      echo "a<br>";
      } else {
      echo "b<br>";
      }
  }
?>
Which of the following is not a valid PHP parser tag?
What is the output of the following code? echo '1'.print(2) + 3;
Which statement will return true?
Within the PHPDoc Standard, what is the correct way of "doc commenting" the code?
Which of the following statements is incorrect, with regards to inheritance in PHP?

Consider the following 2D array in PHP:

$array = array(array(141,151,161), 2, 3, array(101, 202, 303));

Which of the following will display all values in the array?

What is meant by Synchronous Server Calls within PHP's cURL features?

What will be the output of following code?

<?php
$x = 10;
function foo() {
    $x = 20;
    echo $x;
    global $x;
    echo $GLOBALS['x'];
    echo $x;
}
foo();
echo $x;
?>
Which of the following code snippets has the most appropriate headers to force the browser to download a CSV file?
Is the ||= operator present in PHP?
Which of the following features are supported in PHP5?
Which of the following is correct with regard to echo and print?
Which of the following will return the extension of a file name?
Which of the following functions is not related to garbage collection in PHP?

What will be the output of the following code?

<?php
</script>
?>
Which of the following is the best way to get the index(es) of the highest value(s) in an array?

What will be the output of the following code?

<?php
print null == NULL;
?>