title: How can I match the strings in Yii?
body: <p>I got stuck on this.. Let's say, i have string1 &amp; string 2 (in the same model), which string1 has 7 digits and string2's 2 digits.
  then i want to match them together, where 2 of the string1's beginning digits must be same as the string2. I tried this code in model >></p>
  
  <pre><code>public function CekDigit($attribute,$params)
  {
  
  $attribute=substr($this-&gt;string1,0,-7);
  $params=$this-&gt;string2;
  
  if($this-&gt;$attribute==$params['subject'])
  {
  $this-&gt;addError(‘Error’, $params['message']);
  return false;
  }
  }
  </code></pre>
  
  <p>while in rules, i put this code >></p>
  
  <pre><code>    &lt;?php
  
  array('string1','cekdigit','message'=&gt;'the code is unmatched','subject'),
  
  ?&gt;
  </code></pre>
  
  <p>After i made that code, i tried to fill $string1 with 23xxxxxxx
  but  i got an error, which is CException : Property model.23 is not defined. Could anyone help me? Thanks a lot</p>