De koersen worden vanuit een andere website ingelezen. "15,20", "15,58" en "2,50" heb ik nodig, maar de onderstaande code pakt alleen "15,20".
-> ABN AMRO 15,20 15,58 +2,50% <-
-> ABN AMRO 15,20 15,58 +2,50% <-
PHP:
1
2
| ereg('[0-9]{1,2},[0-9]{1,2}', $testABN2, $match); echo "<br>".$match[0]." --- ".$match[1]."hmmmm"; |
Ik snap het niet helemaalIf matches are found for parenthesized substrings of pattern and the function is called with the third argument regs, the matches will be stored in the elements of the array regs. $regs[1] will contain the substring which starts at the first left parenthesis; $regs[2] will contain the substring starting at the second, and so on. $regs[0] will contain a copy of the complete string matched.