-1

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?

hello
  • 351
  • 3
  • 4
  • 16
  • possible duplicate of [Strict Standards: Only variables should be passed by reference](http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference) – Lorenz Meyer Jun 21 '14 at 08:32

3 Answers3

0

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.

Paul Blundell
  • 1,857
  • 4
  • 22
  • 27
0

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);
 }
Arnold Roa
  • 7,335
  • 5
  • 50
  • 69
-1

You can disable this error and it should be ok. Here's a guide https://www.flexicontent.org/site-content/70-developer-api-field-plugins/285-disabling-php-strict-standards-warning-on-development-servers.html Hope it helps.

user3378734
  • 226
  • 1
  • 3
  • 10
  • You shouldn't hide Strict Standards warnings, good practice is to actually fix what caused the warning in the first place. – Paul Blundell Mar 10 '14 at 11:33