I've written some PHP which encases some javascript within a PHP variable, like so:
$js .= 'response['.$x.'] = FinanceDetails("'.$finance_code.'",' . $cart_value . ','.$minimum_deposit.','.$total_cost.');';
But this can be repeated up to three times, and then it's injected between <script> tags and I'd like it to show like so:
response[0] = FinanceDetails("ONIF12",290.00,10,1500);
response[1] = FinanceDetails("ONIF6",290.00,10,1500);
...
But currently it shows in one long string as there are no line breaks. I've tried adding \n and \r as well as \n\r together at the end of the $js value but I just keep getting an Illegal character error - how would I implement a new line / line break in this situation?
<br>then, which is invalid javascript.