Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Php7.1 Fatal error: [] operator not supported for strings [duplicate]

Tags:

php

wordpress

I built a some function theme option wordpress.

But I am receiving the following error now, what am I doing wrong?

  if(isset($thm_options['custom_font1_eot']))
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_eot']['url']}?#iefix') format('embedded-opentype')";

  if(isset($thm_options['custom_font1_woff']))   
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_woff']['url']}') format('woff')";

  if(isset($thm_options['custom_font1_ttf']))
    $w_custom_font1_src[] = "url('{$thm_options['custom_font1_ttf']['url']}') format('truetype')";

Fatal error: [] operator not supported for strings in

Anything I missed code?

like image 253
Hendra Setyawan Avatar asked Dec 19 '22 11:12

Hendra Setyawan


1 Answers

You may have used this variable $w_custom_font1_src as a string somewhere else in the program.

So now reinitialize as an array

 $w_custom_font1_src =  array();
like image 115
Thamaraiselvam Avatar answered Mar 02 '23 00:03

Thamaraiselvam