-1

I have this line

$logos = isset($instance['client_logo']) ? $instance['client_logo'] : [''];

causing this

Parse error: syntax error, unexpected '[' in .../widget-home-clients.php on line 18

How does it need to be changed?

Zurechtweiser
  • 1,165
  • 2
  • 16
  • 29

3 Answers3

3

If [''] is intented to give you an array holding one empty string, you should do array(''), because it appears your PHP version doesn't yet allow for this short syntax - it was introduced with PHP 5.4.

If you just wanted to get an empty string, just replace [''] with ''

Narf
  • 14,600
  • 3
  • 37
  • 66
nl-x
  • 11,762
  • 7
  • 33
  • 61
0

Use this:

$logos = (isset($instance['client_logo'])) ? $instance['client_logo'] : '';
Md Mahfuzur Rahman
  • 2,319
  • 2
  • 18
  • 28
0

Replace your code with the following code...

<?php 
$logos = '';
if(isset($instance['client_logo']) && !empty($instance['client_logo']))
{
    $logos= $instance['client_logo'];
}
?>
Manjeet Barnala
  • 2,975
  • 1
  • 10
  • 20