-1

I'm trying to pass an array value for a data attribute inside a php string but I'm getting the error (syntax error, unexpected 'event' (T_STRING), expecting ',' or ';')

echo '<div class="element-search" data-page-type="event" data-search-types="['event', 'person']">';
user300979
  • 359
  • 1
  • 3
  • 18

1 Answers1

1

You need to escape the qoutes. So ' will become \'

Sahil Gulati
  • 14,792
  • 4
  • 23
  • 42
Remco K.
  • 648
  • 4
  • 18