String digits separated by commas, 48. about the number of digits of a string separated by commas
The string edited by liangcaijian at 16:06:09 is: 0,
48423,48425, 48427,48419, 48413,48415, 48213,48418, 48414,48416, 48411,
Note: extract the bold part...
Effects: 48423,48425, 48427,48419
The delimiter is a string separated by commas (,). The delimiter is separated from the first comma (,) to three commas.
How to implement it? Help, online, etc ..
------ Solution --------------------
$s = '0,48423,48425,48427,48419,48413,48415,48417,48418,48414,48416,48411,';
echo preg_replace('/\d+,((?:\d+,){3}\d+).*/', '$1', $s);
------ Solution --------------------
$string = "0,48423,48425,48427,48419,48413,48415,48417,48418,48414,48416,48411,";
$ar=explode(',',$string);
$arr=array_slice($ar,1,4);
echo join(',',$arr);
------ Solution --------------------
$ Str = ,";
Function jiequ ($ str, $ a, $ B ){
$ Ar = explode (",", $ str );
For ($ I = $ a; $ I <$ B; $ I ++ ){
$ Br [] = $ ar [$ I];
}
Return implode (",", $ br );
}
Echo jiequ ($ str, 5th); // 1 and 5 represent the number between the first and.