Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //original string from textarea
- $string = "1. Vojta\n 2. Zdenda \n 3.Kamarádovi rodiče";
- $lines = explode("\n", $string);
- print_r($lines);
- foreach ($lines as $line) {
- $matches = [];
- preg_match('/^([1-9\ ]*)[\.\ ]*(.*)/', $line, $matches);
- //if no matches found in arrray will be 0 rows
- if(count($matches) > 0) {
- echo trim($matches[2]) . "\n";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment