title: Identical strings not equal in PHP
body: <p>
  
  <pre><code>class VocabularyValidator
  {
      public function __construct()
      {
          $this-&gt;check('termIdenfifier');
      }
  
      public function check ($tst) {
  
          var_dump($tst);
  
          $a = (string)'a:termIdentifier';
          $b = sprintf('a:%s', (string)$tst);
  
          var_dump($a);
          var_dump($b);
  
          var_dump(bin2hex($a));
          var_dump(bin2hex($b));
  
          var_dump(strcmp($a, $b));
          var_dump($a === $b);
      }
  
      public static function check2 ($tst) {
  
          var_dump($tst);
  
          $a = (string)'a:termIdentifier';
          $b = sprintf('a:%s', (string)$tst);
  
          var_dump($a);
          var_dump($b);
  
          var_dump(bin2hex($a));
          var_dump(bin2hex($b));
  
          var_dump(strcmp($a, $b));
          var_dump($a === $b);
      }
  }
  </code></pre>
  
  <p>I call this in a Controller like this:</p>
  
  <pre><code>VocabularyValidator::check2('termIdentifier');
  new VocabularyValidator();
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>string 'termIdentifier' (length=14)
  string 'a:termIdentifier' (length=16)
  string 'a:termIdentifier' (length=16)
  string '613a7465726d4964656e746966696572' (length=32)
  string '613a7465726d4964656e746966696572' (length=32)
  int 0
  boolean true
  
  string 'termIdenfifier' (length=14)
  string 'a:termIdentifier' (length=16)
  string 'a:termIdenfifier' (length=16)
  string '613a7465726d4964656e746966696572' (length=32)
  string '613a7465726d4964656e666966696572' (length=32)
  int 14
  boolean false
  </code></pre>
  
  <p>Why are identical functions giving different results?</p>