ഈ പരിഹാരം 0-കൾ അവഗണിച്ച് സ്ട്രിംഗുകളിൽ നിന്ന് സംഖ്യകൾ വേർതിരിച്ചെടുക്കുകയും മൂന്ന് സ്ട്രിംഗ് നമ്പറുകളായി വേർതിരിക്കുകയും ചെയ്യും.
പരിഹാരം 1.
$string = '02300103024000100';
$output = array();
// First we replace any '00...' string with just '0'
for($a=strlen($string); $a>0; $a--){
$zero_replace = '';
while(strlen($zero_replace) < $a) $zero_replace .= '0';
$string = str_replace($zero_replace,'0',$string);
}
// Now we remove '0' from beginning and end of string (if they exist)
if(substr($string,0,1) == '0') $string = substr($string,1);
if(substr($string,-1,1) == '0') $string = substr($string,0,strlen($string)-1);
// Finally, explode by '0'
$output = explode('0',$string);
print_r($output);
ഔട്ട്പുട്ട്
Array ( [0] => 23 [1] => 1 [2] => 3 [3] => 24 [4] => 1 )