title: PHP failed to load string from other function as parameter
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> public function test_passing_string() {
     $this - &gt; load - &gt; model(array('registration/Registration_model', 'Jawaban_lab_model'));
     $registration = new Registration_model();
     $jawaban_lab = new Jawaban_lab_model();
     $id = "kuda4";
  
     $jawaban_lab - &gt; load($id); //load jawaban_lab from id 
     $manualy_written_registration_number = "REG/FM/130102-0001";
  
     echo "registration number from jawaban_lab-&gt;registration_number : ".$jawaban_lab - &gt; registration_number
       .
     "&lt;br&gt; registration number from manualy_written_registration_number : ".$manualy_written_registration_number;
  
     //$registration-&gt;load($jawaban_lab-&gt;registration_number);
     $registration - &gt; load($manualy_written_registration_number);
  
     echo "&lt;br&gt; patient id : ".json_encode($registration - &gt; PatientID);
   }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Before go to the question, I will explain my code. </p>
  
  <p>On <code>test_passing_string()</code> function, I call 2 model, and create object for each model there are $registration and <code>$jawaban_lab</code>.</p>
  
  <p>To load data from model I create a <code>load()</code> function. <code>load()</code> has two parameters: <code>column_value</code> and <code>column_name</code>. The default value for <code>column_name</code> is that model's Primary Key. </p>
  
  <p><strong>BUT</strong></p>
  
  <p>The problem comes from </p>
  
  <blockquote>
    <p>$registration->load($jawaban_lab->registration_number);</p>
  </blockquote>
  
  <p>I can't retrieve any $registration object data, then I test it by passing the value manually by write this:</p>
  
  <blockquote>
    <p>$manualy_written_registration_number = "REG/FM/130102-0001";
    $registration - > load($manualy_written_registration_number);</p>
  </blockquote>
  
  <p>And the result appear, doesn't that mean my <code>load()</code> function is fine?</p>
  
  <p>Then I check value inside <code>$jawaban_lab-&gt;registration_number</code> by <code>echo</code>ing it, surprisingly it display same value as my <code>$manualy_written_registration_number</code> variable.</p>
  
  <p>This is screenshoot in my browser when I run <code>test_passing_string()</code> function:</p>
  
  <p><strong>Using $manualy_written_registration_number value</strong>
  <a href="https://i.stack.imgur.com/Nlfsw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nlfsw.png" alt="enter image description here"></a></p>
  
  <p><strong>Using $jawaban_lab->registration_number value</strong>
  <a href="https://i.stack.imgur.com/WZUiA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WZUiA.png" alt="enter image description here"></a></p>
  
  <p>Why can't I use the value from
   <code>$jawaban_lab-&gt;registration_number</code> even though it has the same value as
   my manually writen registraiton number?</p>
  
  <pre><code>   public function load($column_value, $column_name = NULL) {
          $query = NULL;
          if ($column_name != NULL) {
              // using custom column.
              $query = $this-&gt;dbs-&gt;get_where($this::DB_TABLE, array(
                  $column_name =&gt; $column_value
              ));
          } else {
              // using column primary key .
              $query = $this-&gt;dbs-&gt;get_where($this::DB_TABLE, array(
                  $this::DB_TABLE_PK =&gt; $column_value
              ));
          }
          if ($query-&gt;row()) {
              $this-&gt;populate($query-&gt;row());
          }
      }
  </code></pre>
  
  <p>I use multiple database using CodeIgniter 3, registration_model from SQL server and jawaban_lab from MySQL, jawaban lab have column registration_number to store registration_model primary key</p>
  
  <h3>var_dump</h3>
  
  <p><a href="https://i.stack.imgur.com/jooQs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jooQs.png" alt="enter image description here"></a></p>