PHP Zend Certified Engineer!

Woot! I’m finally a Zend Certified Engineer (ZCE) for PHP 5.3, it’s about time after more than 8 years of continuously using PHP..


I can’t tell exact questions due to NDA with Zend but here’s some subjects you really should check:

  • late static binding
  • OOP concepts
  • regex
  • functions and arrays
  • passing by reference, returning by reference
  • ALL php functions (name, meaning, expected output, unexpected output)
  • php.ini directives
  • namespacing
  • PDO and databases
  • file uploads
  • streams

As for sample questions.. again you won’t find them online for this exam, but you can always try the ones for PHP4 @ http://koduleht.eu/phpzendtest/.

 

Facebox and remote ajax pages solution

While facebox allows you to load remote pages via ajax, it doesn’t allow you to load ‘real remote’ pages from a different domain due to cross-domain policy. This is where jsonp comes in place.

Here’s a fix for facebox (current version 1.3).
Open up facebox.js and search for the ‘fillFaceboxFromAjax’ function. Now replace

$.get(href, function(data) { $.facebox.reveal(data, klass) })

with

$.ajax({
   url: href,
   dataType: 'jsonp',
   error: function(xhr, status, error) {
      alert(error);
   },
   success: jsonpCallback
});

And add a callback function:

function jsonpCallback(response){
   $.facebox.reveal(response.data, '');
}

Now this will only work if you also modify the remote file you’re calling. Make sure it will look something like this:

header('content-type: application/json; charset=utf-8');
$data = array(
   'data' => $generatedoutput,
);
$json = json_encode($data);
 
echo isset($_GET['callback']) ? "{$_GET['callback']}($json)" : $json;

Where $generatedoutput is your actual data (in this case I use ob_start and ob_get_contents for ease).
$_GET[‘callback’] is a parameter which is added automaticly by jquery. Read their docs for more info: http://api.jquery.com/jQuery.ajax/