$string = \'Some string\'; $pos = 5; ...??... $begging // == \'Some s\'; $end // == \'tring\';
What is the best way to separate string in two by
Regex solution (if you are into it):
... $string = 'Some string xxx xxx'; $pos = 5; list($beg, $end) = preg_split('/(?<=.{'.$pos.'})/', $string, 2); echo "$beg - $end";
Regards
rbo