Monday, August 3, 2009

ZEND MOCK TEST :intersect function list in php 5

there are various kind of intersection functions in php. they are the followings----

array_intersect(array arr1,array arr2,...): it will return the values of arr1 that are in other arrays.
array_intersect_assoc: it will return the values of arr1 with index checking with other arrays.
array_intersect_key: computes comparisons using keys.
array_intersect_uassoc: computes comparisons using association but checking keys by a user function.
array_uintersect_assoc: computes comparisons using association but checking values by a user function.
array_intersect_ukey: computes comparisons using keys.
array_uintersect: computes comparisons using values by a user function.
array_uintersect_uassoc: computes comparisons using association but checking keys and values by a user function.

Question: The following code snippet displays what for the resultant array?

0, 3 => 2, 4 => 6);
$b = array(3 => 1, 4 => 3, 6 => 4);

print_r(array_intersect($a, $b));
?>

Answer:

1. 1 => 0
2. 1 => 3, 3 => 1, 4 => 3
3. 3 => 1, 3=> 2, 4 => 3, 4=> 6
4. 1 => 0, 3 => 2, 4 => 6
5. An empty Array
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

No comments: