note 101337 modified in class.regexiterator by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Dec 2010 20:34:47 +0000 |
| Subject: | note 101337 modified in class.regexiterator by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174785@lists.php.net to get a copy of this message | ||
An exemple :
<?php
$a = new ArrayIterator(array('test1', 'test2', 'test3'));
$i = new RegexIterator($a, '/^(test)(\d+)/', RegexIterator::REPLACE);
$i->replacement = '$2:$1';
print_r(iterator_to_array($i));
/*
Array
(
[0] => 1:test
[1] => 2:test
[2] => 3:test
)
*/
?>
--was--
An exemple :
$a = new ArrayIterator(array('test1', 'test2', 'test3'));
$i = new RegexIterator($a, '/^(test)(\d+)/', RegexIterator::REPLACE);
$i->replacement = '$2:$1';
print_r(iterator_to_array($i));
/*
Array
(
[0] => 1:test
[1] => 2:test
[2] => 3:test
)
*/
http://php.net/manual/en/class.regexiterator.php