-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
  • 389
  • 1
  • 4
  • 18

1 Answers1

1

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

Sahil Gulati
  • 15,028
  • 4
  • 24
  • 42
Remco K.
  • 644
  • 4
  • 19