I want create a helper class that containing method like cleanArray, split_char, split_word, etc.
The helper class it self will be used with many class. example :
Class A will user Helper, Class B, Class C, D, E also user Helper Class
what the best way to write and use helper class in PHP ?
what i know is basic knowledge of OOP that in every Class that use Helper class must create a helper object.
$helper = new Helper();
It that right or may be some one can give me best way to do that.
I also will create XXX Class that may use Class A, B, C, etc.
UPDATE : ->FIXED my fault in split_word method :D
Based on Saul, Aram Kocharyan and alex answer, i modified my code, but its dont work, i dont know why.
<?php
class Helper {
    static function split_word($text) {
        $array =  mb_split("\s", preg_replace( "/[^\p{L}|\p{Zs}]/u", " ", $text ));
        return $this->clean_array($array);
    }
    static function split_char($text) {
        return preg_split('/(?<!^)(?!$)/u', mb_strtolower(preg_replace( "/[^\p{L}]/u", "", $text )));
    }
}
?>
and i use in other Class
<?php
include "Helper.php";
class LanguageDetection {
    public function detectLanguage($text) {
        $arrayOfChar = Helper::split_char($text);
        $words = Helper::split_word($text);
        return $arrayOfChar;
    }
}
$i = new Detection();
print_r($i->detectLanguage("ab  cd    UEEef   する ح      خهعغ فق  12  34   ٢ ٣  .,}{ + _"));
?>
 
     
     
     
     
     
     
    