Wednesday, July 29, 2009

pass by reference in php 5

let's see a zend mock test question for php 5 certification.


Consider the following script:

This code has changed behavior in PHP 5. Identify the output of this script as it would have been in PHP 4, as well as the new behavior in PHP 5.


1. array('a', 'a', 'b')
2. array('a', 'b', 'c')
This will show in php 5.
3. array('c', 'b', 'a')
4. array('c', 'c', 'c')
I think this will be the result for php 4.
5. array('b', 'b', 'b')
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


Georgi said...

I don`t know about PHP4, but PHP5 outputs:
array('c', 'c', 'c')

Anonymous said...

answer is the other way round