Check for php version 5.3 as minimum

And substitute sizeof with !empty and while list each with foreach