PHP Classes

A typo in the code?

Recommend this page to a friend!

      Proper nouns  >  All threads  >  A typo in the code?  >  (Un) Subscribe thread alerts  
Subject:A typo in the code?
Summary:Is there a typo in the method set_symbols?
Messages:2
Author:jv
Date:2012-10-08 23:57:36
Update:2012-10-09 11:00:05
 

 


  1. A typo in the code?   Reply   Report abuse  
Picture of jv jv - 2012-10-08 23:57:36
Great class! This is exactly what I need for my project.

I was just wondering though, if there's a typo in the function set_symbols? To me it seems like it sets the variable $conjunctions instead of $symbols.

So this:

public function set_symbols($arr){
if(!is_array($arr))
{
$this->conjunctions = array(mb_strtolower($arr));
}
else
{
$new = array();
foreach($arr as $val)
{
$new[] = mb_strtolower($val);
}
$this->conjunctions = $new;
}
}

should perhaps be changed to this:

public function set_symbols($arr){
if(!is_array($arr))
{
$this->symbols = array(mb_strtolower($arr));
}
else
{
$new = array();
foreach($arr as $val)
{
$new[] = mb_strtolower($val);
}
$this->symbols = $new;
}
}

  2. Re: A typo in the code?   Reply   Report abuse  
Picture of Arturs Sosins Arturs Sosins - 2012-10-09 11:00:05 - In reply to message 1 from jv
Yes, you are completely right. I've checked the revision and bug was introduced when I updated the class to use multi byte functions, probably due to copying.

Thank you for stating this, I've updated submitted class. ;)