Question

The code from Qdig Gallery is:

$excl_imgs[] = end($logo_arrray = explode('/', $header['css_logo_url']));
$excl_imgs[] = end($bg_img_array = explode('/', $header['css_bg_img_url']));

which gives the above error (Strict Standards).

How do I fix this?

Was it helpful?

Solution

Do this instead and your error should go away:

$logo_arrray = explode('/', $header['css_logo_url']);
$bg_img_array = explode('/', $header['css_bg_img_url']);

$excl_imgs[] = end($logo_arrray);
$excl_imgs[] = end($bg_img_array);

You should always try and fix any Strict Standards warning and not just hide them.

OTHER TIPS

I liked to do this to have my code in one line, you can write this method and use end_legacy instead of end when want to use end like that.

 function end_legacy($arr){
   if (empty($arr))return false;
   if ( PHP_VERSION_ID > 50400) {
     $count = count($arr);
     $arr = array_values($arr);
     return $arr[ $count-1 ];
   }
   return end($arr);
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top