<?php class my_cls{ function __construct(){ $this->str=str_split('sfjhfsjfskdksdjkfskjsfkjsfkjfsfjvjhfjhv',1); } public function array_index($t){ return array_search($t, $this->str); } public function test($str){ for($i=0;$i<floor(strlen($str)/2);$i++){ $arr = array_map("my_cls::array_index",str_split(substr($str,$i*2,2))); } } }