-2

I have this line of code in my file, but in the return array part, I need to have double quotes inside the array.

If I leave the way it is right now, it crashes.

How can I solve this problem?

if ($number_of_picture_allowed <= $number_of_picture)
        return array('error' => "{tr domain="PhrasesInTemplates"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);

Thanks in advace, Arky

Matt Taylor
  • 3,360
  • 1
  • 20
  • 34
Arkymedes
  • 179
  • 5
  • 12

4 Answers4

1

You can escape quotes inside the array using \

    return array('error' => "{tr domain=\"PhrasesInTemplates\"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);
Jay Bhatt
  • 5,601
  • 5
  • 40
  • 62
1

Escape those quotes using the backslash (\). Hence your return should look:

return array('error' => "{tr domain=\"PhrasesInTemplates\"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);
George
  • 36,413
  • 9
  • 66
  • 103
1
if ($number_of_picture_allowed <= $number_of_picture)
    return array('error' => "{tr domain=\"PhrasesInTemplates\"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);

Try this. PHP Double Quotes

E.K.
  • 21
  • 5
0

Try this :

  1. Wrap the content in single quotes $arr = array('error' => '{tr domain="PhrasesInTemplates"}You already selected the maximum amount of pictures for this shirt!{/tr}','file_sid' => $fileSid);

  2. Escape quotes using backslash(\) \"

Prasanth Bendra
  • 31,145
  • 9
  • 53
  • 73