Skip to content

Instantly share code, notes, and snippets.

@salathe
Created October 6, 2014 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salathe/4b74ab41be52710f692a to your computer and use it in GitHub Desktop.
Save salathe/4b74ab41be52710f692a to your computer and use it in GitHub Desktop.
[peter@Bibracte php-src.git (pull-request/865 *)]$ cat foo.php
<?php
$array = new ArrayIterator(array('a', array('b', 'c')));
$regex = new RegexIterator($array, '/banana/');
foreach ($regex as $match) {
var_dump($match);
}
[peter@Bibracte php-src.git (pull-request/865 *)]$ ./sapi/cli/php foo.php
array(2) {
[0]=>
string(1) "b"
[1]=>
string(1) "c"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment