0

I want to add new line to an existing string I tried this way

$filename = 'popups-'.$jsonData['name'].'.js';
$text = $jsonData['text'].'\n';

However I get \n directly append in the string instead of a new line What am I doing wrong here??

Anant Kumar Singh
  • 68,309
  • 10
  • 50
  • 94

1 Answers1

4

you should use double quotes for this

$filename = 'popups-'.$jsonData['name'].'.js';
$text = $jsonData['text']."\n";

http://php.net/manual/en/language.types.string.php

line88
  • 948
  • 9
  • 24