title: How can I append a string to an object property?
body: <p>I am trying to send a response back to my front end with the amount of days in a customers billing period. I query this number but would like to append <code>" Days"</code> after it. So far I have:</p>
  
  <pre><code>&lt;?php
  require "../../inc/dbinfo.inc";
  
  $projectnum =$_POST['projectnum'];
  
  $sql = $conn-&gt;prepare("SELECT (SELECT TermsofPayment FROM tblCustomers WHERE CUSTOMERID = ProjectCustomer) AS NetTerms FROM tblProjects WHERE PROJECTNOID = ?");
  
  if($sql){
    $sql-&gt;bind_param("i", $projectnum);
    $sql-&gt;execute();
    $hold = $sql-&gt;get_result();
    $obj = $hold-&gt;fetch_assoc();
    $addOn = " Days";
    $obj-&gt;NetTerms = $obj-&gt;{'NetTerms'. $addOn};
  
    echo json_encode($obj);
  }
  $sql-&gt;close();
  exit();
  
  ?&gt;
  </code></pre>
  
  <p>After trial and error it appears as though the second last line has no effect on the result. I've looked through the web to find no solutions to this (maybe my search didn't contain the right keywords).</p>
  
  <p>Current Response: <code>{"NetTerms":30}</code></p>
  
  <p>Desired Response: <code>{"NetTerms":30 Days}</code></p>