String:
Tkpc10090987tkpc10098m9ytkmr120990u9tkmr10059e56
Requirements:
1, interception of each tkpc and TKMR after the continuous 5-digit number. (Examples of interception should be tkpc have 11090,12098,TKMR have 12099,11059)
2, after the interception of the number according to the following conditions, for the true echo Yes.
2.1 TKPC Two sets of numbers, if there is less than or equal to 11069, echo satisfies the condition for each group of tkpc+ after 8 bits.
2.1 TKMR Two sets of numbers, if there is less than or equal to 10999, echo satisfies the condition for each group of tkmr+ after 8 bits.
Reply to discussion (solution)
$str = "tkpc10090987tkpc10098m9ytkmr120990u9tkmr10059e56"; for ($i = 0, $len = strlen ($STR); $i < $len; $i + +) { if (s Ubstr ($str, $i, 4) = = ' tkpc ') { if (substr ($str, $i +4, 5) <= 11069) { echo ' tkpc '. substr ($str, $i +4, 8). "\ n"; } } if (substr ($str, $i, 4) = = ' Tkmr ') { if (substr ($str, $i +4, 5) <= 10999) { echo ' tkmr '. substr ($str, $i +4, 8). "\ n";}} }
Tkpc10090987tkpc10098m9ytkmr10059e56